From 811280a8b259e6cc29adc80d9e4afe9324693d5d Mon Sep 17 00:00:00 2001 From: kulisak12 Date: Wed, 14 Sep 2022 10:31:37 +0200 Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Na=C4=8Dten=C3=AD=20kopc?= =?UTF-8?q?=C5=AF=20z=20configu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/bin/create_game | 33 +++++++++++++++++++++++++++++++++ server/hra/game.py | 10 ++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/server/bin/create_game b/server/bin/create_game index d437f70..cfc4a29 100755 --- a/server/bin/create_game +++ b/server/bin/create_game @@ -15,6 +15,39 @@ configuration = { "teams_height": 4, "width_per_team": 30, "height_per_team": 30, + # seed=5 + "hills": [ + ".xx....x......................", + ".xxx...xx.....................", + "...x...............x......x...", + ".......xx..........xx.........", + ".......xx.....................", + ".......x......................", + "..............................", + ".............xxx......xx......", + ".............xx.......xx......", + "......................xx......", + "...xx....x............x.......", + "...xx....xx...................", + "..............................", + "......x.......................", + ".....x........................", + ".x............................", + ".x.....................x......", + ".x....................xx......", + "......................xx......", + "..xx...................x......", + ".xxx..........................", + "..............................", + "............xxx......xx.......", + "............xx.......xx.......", + ".......................x......", + ".....x........x........x......", + "..............xxx........x....", + "..............................", + ".............x................", + "............xx................" + ] } g = db.Game(game_mode=mode, configuration=configuration, teams_count=teams_count) diff --git a/server/hra/game.py b/server/hra/game.py index 9506695..784b8f5 100644 --- a/server/hra/game.py +++ b/server/hra/game.py @@ -52,18 +52,20 @@ class Occupy(Logic): # Počáteční stav def zero_state(self) -> Any: - # TODO: Zatím negeneruju "hills" map = [ [ { "home_for_team": None, "occupied_by_team": None, - "hill": False, + "hill": (self.configuration["hills"] + [j % self.configuration["height_per_team"]] + [i % self.configuration["width_per_team"]] + == "x"), "members": [] } - for _ in range(self.map_width) + for i in range(self.map_width) ] - for _ in range(self.map_height) + for j in range(self.map_height) ] team_id = 0 home_y = self.configuration["height_per_team"] // 2