#!/usr/bin/env python3 from hra.game import logic_by_mode import hra.db as db import hra.lib as lib import sys from sqlalchemy import exc, update ses = db.get_session() mode = "occupy" teams_count = 16 configuration = { "teams_width": 4, "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) ses.add(g) ses.commit() g.lock() s = db.State(game_id=g.game_id, round=0, state=g.get_logic().zero_state()) ses.add(s) for i in range(teams_count): t = db.Team(team_id=i, game_id=g.game_id, name="") ses.add(t) g.current_round = 0 g.working_on_next_state = False ses.commit() print(f"Přidána hra {g.game_id}. ")