From e7bede9f5fe694fcc5039d63ee748713f33acd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Pierzy=C5=84ski?= Date: Mon, 1 Apr 2019 13:32:08 +0200 Subject: [PATCH 1/2] Czyszczenie repo --- Resources/Maps/map_001.txt | 2 +- __pycache__/config.cpython-36.pyc | Bin 548 -> 571 bytes c | Bin 8296 -> 0 bytes c.c | 11 ----------- config.py | 2 +- 5 files changed, 2 insertions(+), 13 deletions(-) delete mode 100755 c delete mode 100644 c.c diff --git a/Resources/Maps/map_001.txt b/Resources/Maps/map_001.txt index 4333db7..4c03fdc 100644 --- a/Resources/Maps/map_001.txt +++ b/Resources/Maps/map_001.txt @@ -1,4 +1,5 @@ 9 9 +2 1 E E E H E E E E E E Y R R E H E E E E R E R E R E G E @@ -8,4 +9,3 @@ R R R R R E R R E E B R H E R R H E E E R R R R E E E E E E E H R R R H -3 1 diff --git a/__pycache__/config.cpython-36.pyc b/__pycache__/config.cpython-36.pyc index b9af045a53a3b4bcce3eebb88d498a4352f0a32d..c4348dfb9e1348f7a18579118265d0a7093a45be 100644 GIT binary patch delta 143 zcmZ3&vYSQOn3tEU_S?c3Aw~v<#|%h-1;};);^K^n%BB`69L{Cu1s`0uu)#2NM9Sq8tMN delta 119 zcmdnZvV=w1n3tDJ=jp;2Rz?Pf#|%h-8OU}3;^L%<%BDum3|Sn_3@!}Kj4@16oKak< zT&YYV3{l*voM4(Kl`)Gqg(ZcfnJJ1dg)x{xlXK#Pi)`FL{hIufa~LBgUtmmSlVajv Hg=pe)N}{}n62_4+!^ z&Y=(4umXkN=Sh$K{G=r$f(N9(`Ql=T|DZBlwIQ7vXxp+OooGp?vc<8MvG%r>wk?rD zF0x6Fo9(mguDu6!PdwiUE&IHTevEN@Hu{?j`B#53G+eXd!{49!@(ZuG{Cb9U@uTV| zE;~swTt#{bVNF%=d*;C(Cp=t5{!8=VZ2R6S@`~a#$YE(yqxn?U8d9b?I2JdDQrUPq zbtFkFOPB>Kp0~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o<47=Rx5 zX{s=W{*h;eMA0knnGW><=`z+zKWBmd15S|Y(09_x+H=T8rT;1Up7@;M91{LuU*Po# g-yP~|9d8y?d>-TI*KXxpx4Qm%>0kzeLcRL`2FTJBd;kCd diff --git a/c.c b/c.c deleted file mode 100644 index 8b3d58a..0000000 --- a/c.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main( void ) { - - char c = NULL; - int b = c || 5; - - printf("%d\r\n", b); - - return 0; -} diff --git a/config.py b/config.py index d34b059..0ad8430 100644 --- a/config.py +++ b/config.py @@ -4,7 +4,7 @@ CELL_SIZE = 64 FPS = 60 map = open( sys.argv[1], 'r' ) -GRID_WIDTH, GRID_HEIGHT = [int(x) for x in map.readline().split()] +GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y = [int(x) for x in map.readline(2).split()] WINDOW_HEIGHT = GRID_HEIGHT * CELL_SIZE WINDOW_WIDTH = GRID_WIDTH * CELL_SIZE From 7cf49721a5728f126ac3e63baa141fa441fd5b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Pierzy=C5=84ski?= Date: Mon, 1 Apr 2019 14:07:27 +0200 Subject: [PATCH 2/2] Wersja z problemem generowania prostokatnych map --- DataModels/GC.py | 3 +-- DataModels/__pycache__/GC.cpython-36.pyc | Bin 562 -> 562 bytes Resources/Maps/map_002.txt | 3 ++- Resources/Maps/map_003.txt | 3 ++- Resources/Maps/map_004.txt | 1 + __pycache__/config.cpython-36.pyc | Bin 571 -> 689 bytes config.py | 4 +++- main.py | 17 +++++++---------- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/DataModels/GC.py b/DataModels/GC.py index b685404..64dac80 100644 --- a/DataModels/GC.py +++ b/DataModels/GC.py @@ -2,5 +2,4 @@ from DataModels.Cell import Cell class GC( Cell ): def __init__( self, x, y, max_rubbish, yellow = 0, green = 0, blue = 0): - Cell.__init__(self, x, y, max_rubbish, yellow, green, blue ) - \ No newline at end of file + Cell.__init__(self, x, y, max_rubbish, yellow, green, blue ) \ No newline at end of file diff --git a/DataModels/__pycache__/GC.cpython-36.pyc b/DataModels/__pycache__/GC.cpython-36.pyc index c3ac277ed2dec98c495341fe6d86402977ddf3eb..8136c1d4b3426d2a9e8d8951a94e60a053c81f26 100644 GIT binary patch delta 18 ZcmdnQvWbP$n3tEU|JTBpqZ>IjnE*FT1^oa3 delta 18 acmdnQvWbP$n3tDp*87Dq=QeU`G64WLga!rx diff --git a/Resources/Maps/map_002.txt b/Resources/Maps/map_002.txt index 19807a0..f55bca5 100644 --- a/Resources/Maps/map_002.txt +++ b/Resources/Maps/map_002.txt @@ -1,6 +1,7 @@ 6 5 +1 0 Y R R R E H E R E R R R H R B R H R E R R R R G -E H E E R H \ No newline at end of file +E H E E R H diff --git a/Resources/Maps/map_003.txt b/Resources/Maps/map_003.txt index b5f82f9..5f24c00 100644 --- a/Resources/Maps/map_003.txt +++ b/Resources/Maps/map_003.txt @@ -1,5 +1,6 @@ 13 4 +3 0 E Y R R R H H R R R E E E H R R H R R R R H R R H E E E R E H E R H R E R R G -H R R E E B R R R H E R H \ No newline at end of file +H R R E E B R R R H E R H diff --git a/Resources/Maps/map_004.txt b/Resources/Maps/map_004.txt index 01a932b..2627a89 100644 --- a/Resources/Maps/map_004.txt +++ b/Resources/Maps/map_004.txt @@ -1,4 +1,5 @@ 12 10 +1 0 Y R R R E H R R R R R E E R E R R E R E H E R H H R R H R R R R R R R E diff --git a/__pycache__/config.cpython-36.pyc b/__pycache__/config.cpython-36.pyc index c4348dfb9e1348f7a18579118265d0a7093a45be..30b86bc0b7ae24de8db7215b6d97122bb1fa7603 100644 GIT binary patch delta 197 zcmdnZvXNEUn3tF9{ojQ#HjE4mj~S2vGmz~7#Kkoel}*)}8L~K<8C)2e8Dp5DIHR~y zI8xYK7*g4?*pX!>W<3+&0O?@@5^M}b+(2sL3O%zTHXuWjv4|Z+F%^N76mfzGkT`_k x0DWn3tEU_S?c3Aw~v<#|%h-1;};);^K^n%BDgo9LwDB93K%i*`6s*hz}?sz{JAH!X&_`z{J7G G!2|$ktQ5Ea diff --git a/config.py b/config.py index 0ad8430..0b315ab 100644 --- a/config.py +++ b/config.py @@ -4,7 +4,9 @@ CELL_SIZE = 64 FPS = 60 map = open( sys.argv[1], 'r' ) -GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y = [int(x) for x in map.readline(2).split()] + +GRID_WIDTH, GRID_HEIGHT = [int(x) for x in map.readline().split()] +GC_X, GC_Y = [int(x) for x in map.readline().split()] WINDOW_HEIGHT = GRID_HEIGHT * CELL_SIZE WINDOW_WIDTH = GRID_WIDTH * CELL_SIZE diff --git a/main.py b/main.py index 80e49b0..864acd7 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ import pygame, sys from random import randint -from config import WINDOW_HEIGHT, WINDOW_WIDTH, GRID_HEIGHT, GRID_WIDTH, HOUSE_CAPACITY, FPS +from config import WINDOW_HEIGHT, WINDOW_WIDTH, GRID_HEIGHT, GRID_WIDTH, HOUSE_CAPACITY, FPS, GC_X, GC_Y from DataModels.Grass import Grass from DataModels.House import House @@ -12,10 +12,11 @@ from DataModels.GC import GC pygame_sprites = pygame.sprite.Group() FPS_CLOCK = pygame.time.Clock() -GAME_WINDOW = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT), 0, 32) +GAME_WINDOW = pygame.display.set_mode( (WINDOW_WIDTH, WINDOW_HEIGHT), 0, 32) map = open(sys.argv[1], 'r') map.readline() +map.readline() map_objects = [ [ None for y in range(0,GRID_WIDTH)] for x in range(0, GRID_HEIGHT)] @@ -33,8 +34,9 @@ def generate( letter ): i = 0 for y in map.readlines(): for x in y.split(): - x_coord = i % GRID_WIDTH - y_coord = i // GRID_WIDTH + + y_coord = i % GRID_WIDTH + x_coord = (i - y_coord)//GRID_WIDTH yellow, green, blue = [randint(0, HOUSE_CAPACITY //2),randint(0, HOUSE_CAPACITY //2),randint(0, HOUSE_CAPACITY //2)] if x is 'E': @@ -51,16 +53,11 @@ for y in map.readlines(): map_objects[x_coord][y_coord] = generate(x)(x_coord, y_coord) i += 1 - -print( GRID_WIDTH, GRID_HEIGHT ) -print( map_objects ) - - for line in map_objects: for item in line: pygame_sprites.add(item) -pygame_sprites.add( GC(0,0,2) ) +pygame_sprites.add( GC(GC_X, GC_Y, 2) ) while True: