Exemplo n.º 1
0
states = SimulationStateList.create_with_empty_states(400)

s_blocks = {}
b_blocks = {}
robots = {}
for instruction in SInstruction:
    s_blocks[get_next_coord()] = ScaffoldState(instruction)

b_blocks[get_next_coord()] = BuildingBlockState()

for direction in Direction:
    for held_block in HeldBlock:
        robot = BuilderState()
        robot.block = held_block
        robot.direction = direction
        coord = get_next_coord()
        s_blocks[coord] = ScaffoldState(SInstruction.DRIVE_RIGHT)
        robots[coord] = robot

states.states[0].s_blocks = s_blocks
states.states[0].b_blocks = b_blocks
states.states[0].robots = robots
goal = Goal(get_next_coord(), GoalType.PLACE_SCAFFOLD)
states.states[0].target_structure = [get_next_coord()]
states.states[0].goal_stack.append(goal)

s_blocks = {}
b_blocks = {}
robots = {}
for instruction in SInstruction:
    get_next_coord(): ScaffoldState(SInstruction.NONE),
    get_next_coord(): ScaffoldState(SInstruction.STOP),
    get_next_coord(): ScaffoldState(SInstruction.STOP),
    get_next_coord(): ScaffoldState(SInstruction.NONE),

    # row 9
    get_next_coord(): ScaffoldState(SInstruction.DRIVE_RIGHT),
    get_next_coord(): ScaffoldState(SInstruction.NONE),
    get_next_coord(): ScaffoldState(SInstruction.NONE),
    get_next_coord(): ScaffoldState(SInstruction.DRIVE_RIGHT),
    get_next_coord(): ScaffoldState(SInstruction.STOP),
    get_next_coord(): ScaffoldState(SInstruction.STOP),
    get_next_coord(): ScaffoldState(SInstruction.DRIVE_RIGHT),
    get_next_coord(): ScaffoldState(SInstruction.NONE),
    get_next_coord(): ScaffoldState(SInstruction.NONE),
    get_next_coord(): ScaffoldState(SInstruction.DRIVE_RIGHT),
}

sim = SimulationState()
sim.s_blocks = s_blocks

robot = BuilderState()
robot.direction = Direction.EAST
robot.block = HeldBlock.BUILD
sim.robots = {Coordinate(1, 0): copy.copy(robot)}

root = tk.Tk()
player = BasicPlayer(root, sim)
player.grid()
root.mainloop()