Пример #1
0
def text_example():
    ''' Prints the state of the game to stdout after each round of turns '''

    goody0 = RandomGoody()
    goody1 = RandomGoody()
    baddy = RandomBaddy()

    game = Game(EXAMPLE_MAZE * (2, 2), goody0, goody1, baddy)

    def hook(game):
        print(game, "\n")
        time.sleep(0.1)  # Max speed of 10 updates per second

    game.play(hook=hook)
Пример #2
0
def main():
    print("Player 1 use Space \nPlayer 2 use Right Arrow")
    SIZE = int(input("Insert Playing size (20 - 100): "))
    if SIZE < 20:
        SIZE = 20
    if SIZE > 100:
        SIZE = 100
    DISPLAY_SIZE = int(
        input("Insert display size (marimea laturii patratului ferestrei): "))
    play_style = input("Game mode: (R)andom/(G)rid: ")
    pygame.display.init()
    game = Game(SIZE, DISPLAY_SIZE, play_style)
    game.run()
    pygame.display.quit()