def build_game_with_2maps_winning_picks_team1_and_team3(): game = Game(None, team1.id_team, team3.id_team, None, 2, 1, team1.id_team, 3, "Mapa 1", "Mapa 2", "", "", "Mapa 3", team1.actual_rank, team3.actual_rank) game.team1 = team1 game.team2 = team3 map1 = Map(game.id_game, "Mapa 1", 9, 6, 7, 6, 0, 0, 16, 12) map2 = Map(game.id_game, "Mapa 2", 8, 7, 8, 4, 0, 0, 16, 11) game.maps = [map1, map2] return game
def build_game_with_3maps_winning_picks(): game = Game(None, team1.id_team, team2.id_team, None, 2, 1, team1.id_team, 3, "Mapa 1", "Mapa 2", "", "", "Mapa 3", team1.actual_rank, team2.actual_rank) game.team1 = team1 game.team2 = team2 map1 = Map(game.id_game, "Mapa 1", 9, 6, 6, 2, 0, 0, 16, 8) map2 = Map(game.id_game, "Mapa 2", 7, 8, 6, 8, 0, 0, 13, 16) map3 = Map(game.id_game, "Mapa 3", 7, 8, 6, 8, 0, 0, 13, 16) game.maps = [map1, map2, map3] return game
def __init__(self): self.__map = Map(is_auto_init=True) self.__color_current_move = PieceColor.WHITE self.__checked_king = CheckedKingGetter(self.map).get_checked_king() self.__game_is_finished = False self.__map_cvs = MapCVS() self.__map_cvs.add_map(self.map)
def setUp(self): self.c1 = Country.from_json([[[0, 0], [200, 200], [100, 300]]]) self.c2 = Country.from_json([[[0, 0], [200, 0], [200, 200]]]) self.c3 = Country.from_json([[[0, 0], [0, 300], [100, 300]]]) self.c4 = Country.from_json([[[200, 200], [100, 300], [500, 500]]]) self.c_map = Map([self.c1, self.c2, self.c3, self.c4])
def auth_viewer(data): print rooms() token = data['token'] print token, "viewer", type(token) if token not in game: game[token] = Map() join_room(token) emit('result', {'token': token, 'data': game[token].to_json()})
def save(self): self.add_country() name = "./maps/map_{}.json".format(str(uuid.uuid4())) new_map = Map(self.countries) with open(name, 'w') as f: f.write(new_map.to_json()) msg = QtWidgets.QMessageBox() msg.setText("Saved to {}".format(name)) msg.setWindowTitle("Saved") msg.exec_()
def reload(): # Box on Map Handler box = self.canvas.getBox() self.currentFilter = DataHandler.EMPTY_FILTER if box is not None: self.currentFilter['box'] = box else: self.currentFilter['box'] = None if boxAroundVar.get() == 'Attacker': self.currentFilter['box_around'] = 'Attacker' else: self.currentFilter['box_around'] = 'Victim' # Map Selector self.canvas.setMap(Map(currentMap.get())) self.currentFilter['map'] = "'" + currentMap.get() + "'" # Attack Side Selector if attSideVar.get() == "Both": self.currentFilter['att_side'] = None else: self.currentFilter['att_side'] = "'" + attSideVar.get() + "'" # Victim Side Selector if vicSideVar.get() == "Both": self.currentFilter['vic_side'] = None else: self.currentFilter['vic_side'] = "'" + vicSideVar.get() + "'" # User ID Entry if idEntry.get() != 'None': self.currentFilter['att_id'] = int(idEntry.get()) else: self.currentFilter['att_id'] = None # Weapon Selection if weaponVar.get() != 'All': self.currentFilter['wp'] = "'" + weaponVar.get() + "'" else: self.currentFilter['wp'] = None for key, data in enumerate(vicAndAttRankRange): if data.get() != '': self.currentFilter['player_rank_range'][key] = int( data.get()) else: # if key is an odd number set value to 18, else even set 0 self.currentFilter['player_rank_range'][key] = 18 * (key % 2) self.canvas.addData(self.data.applyFilter(self.currentFilter)) self.canvas.reloadImage()
def __init__(self, loc, **args): Canvas.__init__(self, loc, args) self.minX = None self.minY = None self.maxX = None self.maxY = None self.box = None self.clickNum = 0 self.currentImage = None self.canvasImage = None self.map = Map(Map.MAPS[2]) self.bind('<Button-1>', self.click)
def createMap(self, game_id, map_name, team1_tr_rounds, team2_tr_rounds, team1_ct_rounds, team2_ct_rounds, overtime_team1_rounds, overtime_team2_rounds, team1_total_rounds, team2_total_rounds): c1 = Map(game_id, map_name, team1_tr_rounds, team2_tr_rounds, team1_ct_rounds, team2_ct_rounds, overtime_team1_rounds, overtime_team2_rounds, team1_total_rounds, team2_total_rounds) try: self.session.add(c1) self.session.commit() except: self.session.rollback() raise return c1
def open_map(self): infile = Path(self.map_file).open() # Do not bother with any validation for now. self.grid_size = float(infile.readline()) self.cell_size = float(infile.readline()) # Addition of the boundary. #self.grid_size += self.cell_size self.grid_size = int(self.grid_size / self.cell_size) self.robot.cell_size = self.cell_size self.map = Map(self.robot, self.grid_size * self.cell_size, self.cell_size) y = self.grid_size - 1 while y >= 0: line = infile.readline() for x in range(self.grid_size): if line[x] == "#": self.map.grid[x][y].state = 2 elif line[x] == "R": self.robot.change_odometry(round(x * self.cell_size, 2), round(y * self.cell_size, 2), 1.57) #print("Waiting for odometry change...") # Wait for odometry change to take affect. #while self.robot.x != round(x * self.cell_size, 2) and self.robot.y != round(y * self.cell_size, 2): # continue #print("Odometry change successful!") elif line[x] == "G": self.map.goal_x = x self.map.goal_y = y elif line[x] == " ": self.map.grid[x][y].state = 1 y -= 1 infile.close()
def __init__(self): # Bluetooth. connection = BluetoothConnection("00:00:12:06:56:83", 0x1001) # IP #connection = IPConnection("10.42.0.1", 50001) # USB Serial. #connection = SerialConnection("/dev/ttyACM1", 115200) self.proxy = Proxy(connection) self.proxy.listeners.append(self) self.robot = Robot(self.proxy) self.robot.x = 1.15 self.robot.y = 1.15 self.map = Map(self.robot, 2.3, 0.23) self.path_planner = GridNav(self.map) Thread.__init__(self)
from model.hero import * from model.map import Map from model.parameters import Parameters from model.state import State from model.abilites import AbilityType from model.teams import Teams import json import random import time game = json.loads(input()) game_map = Map(game) # карта игрового мира game_params = Parameters(game) # параметры игры game_teams = Teams(game) # моя команда while True: try: """ Получение состояния игры """ state = State(input(), game_teams, game_params) my_buildings = state.my_buildings() my_squads = state.my_squads() # сортируем по остаточному пути my_squads.sort(key=lambda c: c.way.left, reverse=False) enemy_buildings = state.enemy_buildings() enemy_squads = state.enemy_squads() neutral_buildings = state.neutral_buildings() forges_buildings = state.forges_buildings()
def connect(): token = 1 game[token] = Map() emit('result', {'token': token, 'data': game[token].to_json()})
def init_game(token): print token, "client", type(token) game[token] = Map() emit('result', {'token': token, 'data': game[token].to_json()})
def __init__(self, setup): self.__setup = setup self.__status = STATUS.STOPPED self.__map = Map(setup.height, setup.width) self.__logs = []