def create_row(self, actual_room, rest, first_tiles, index, is_last): f_tile = copy.deepcopy(self.tile) if first_tiles.get(index) is not None: f_tile.length = first_tiles.get(index) elif rest != 0: f_tile.length = rest m_tile = copy.deepcopy(self.tile) last_row_width = actual_room.l2 % self.tile.width if is_last and last_row_width > 0: m_tile.width = last_row_width f_tile.width = last_row_width row = [f_tile] whole_tiles = math.floor( (actual_room.l1 - f_tile.length) / self.tile.length) for t in range(whole_tiles): row.append(copy.deepcopy(m_tile)) last = actual_room.l1 - f_tile.length - whole_tiles * m_tile.length if last != 0: row.append(Tile(last, m_tile.width)) r = m_tile.length - last return row, r
def test_b(self): room = Room(100, 50) tile = Tile(60, 20) border = 0 init = {} installation = Installation(room, tile, border, init) plan = installation.process() installation.print() self.sanity_checks(init, plan, room, border)
def get_tile(self): ''' :rtype: List[Tile] ''' cursor = self.qn.cursor() cursor.execute("select name, desc from tile") res = cursor.fetchall() tiles = [] for line in res: tile = Tile(line[0], line[1]) tiles.append(tile) return tiles
def test_a(self): room = Room(3330, 2700) tile = Tile(1286, 194) border = 8 init = { 0: 1286, 12: 1286 } installation = Installation(room, tile, border, init) plan = installation.process() installation.print() self.sanity_checks(init, plan, room, border)
def main(): room = Room(3330, 2700) tile = Tile(1286, 194) border = 8 init = { 5: 1286, 10: 1286 } installation = Installation(room, tile, border, init) plan = installation.process() installation.print() Printer.print(plan)
def __init__(self, player): self.grid = [[Tile(player) for x in range(8)] for y in range(8)] self.player = player self.width = board_params['cell_width'] self.height = board_params['cell_height'] self.margin = board_params['margin']
def __init__(self): study = Tile("Study", TileType.ROOM) hall = Tile("Hall", TileType.ROOM) lounge = Tile("Lounge", TileType.ROOM) library = Tile("Library", TileType.ROOM) billiard = Tile("Billiard Room", TileType.ROOM) dining = Tile("Dining Room", TileType.ROOM) conservatory = Tile("Conservatory", TileType.ROOM) ball = Tile("Ball Room", TileType.ROOM) kitchen = Tile("Kitchen", TileType.ROOM) h_sh = Tile("h_sh", TileType.HALLWAY) #hallway between 'S'tudy and 'H'all h_hl = Tile("h_hl", TileType.HALLWAY) h_sl = Tile("h_sl", TileType.HALLWAY) h_hb = Tile("h_hb", TileType.HALLWAY) h_ld = Tile("h_ld", TileType.HALLWAY) h_lb = Tile("h_lb", TileType.HALLWAY) h_bd = Tile("h_bd", TileType.HALLWAY) h_lc = Tile("h_lc", TileType.HALLWAY) h_bb = Tile("h_bb", TileType.HALLWAY) h_dk = Tile("h_dk", TileType.HALLWAY) h_cb = Tile("h_cb", TileType.HALLWAY) h_bk = Tile("h_bk", TileType.HALLWAY) study.set_connected([h_sh, h_sl, kitchen]) hall.set_connected([h_sh, h_hl, h_hb]) lounge.set_connected([h_hl, h_ld, conservatory]) library.set_connected([h_sl, h_lb, h_lc]) billiard.set_connected([h_hb, h_lb, h_bd, h_bb]) dining.set_connected([h_ld, h_bd, h_dk]) conservatory.set_connected([h_lc, h_cb, lounge]) ball.set_connected([h_cb, h_bb, h_bk]) kitchen.set_connected([h_bk, h_dk, study]) h_sh.set_connected([study, hall]) h_hl.set_connected([hall, lounge]) h_sl.set_connected([study, library]) h_hb.set_connected([hall, billiard]) h_ld.set_connected([lounge, dining]) h_lb.set_connected([library, billiard]) h_bd.set_connected([billiard, dining]) h_lc.set_connected([library, conservatory]) h_bb.set_connected([billiard, ball]) h_dk.set_connected([dining, kitchen]) h_cb.set_connected([conservatory, ball]) h_bk.set_connected([ball, kitchen]) self.board = [ study, hall, lounge, library, billiard, dining, conservatory, ball, kitchen, h_sh, h_hl, h_sl, h_hb, h_ld, h_lb, h_bd, h_lc, h_bb, h_dk, h_cb, h_bk ]