Exemplo n.º 1
0
 def clear_screen(self):
     """
     Clear the whole screen (i.e: remove everything written in terminal)
     """
     Utils.clear_screen()
Exemplo n.º 2
0
                ui_board_void_cell=Utils.BLACK_SQUARE, # Cells with nothing inside are going to be black squares
                player_starting_position=[10,20]
                )

# Then create a player 
playerone = Player( model=Utils.yellow_bright('××') )

# Place it on the board
myboard.place_item(playerone, 10,10)

# Now let's display our board
myboard.display()

# And make a short loop that moves the player and display the board 
# WARNING: in real life we would use the Game object to manage the game and the screen

for k in range(1,10,1):
    # Clear screen
    Utils.clear_screen()
    # Print a debug message
    Utils.debug(f'Round {k} player position is ({playerone.pos[0]},{playerone.pos[1]}) -- BEFORE moving')
    # Ask myboard to move playerone to the right by one cell
    myboard.move(playerone, Constants.RIGHT, 1 )
    # print another debug message
    Utils.debug(f'Round {k} player position is now ({playerone.pos[0]},{playerone.pos[1]}) -- AFTER moving')
    # and display the board
    myboard.display()
    # Wait a second to let you admire the work!
    time.sleep(1)