Пример #1
0
def state2Cards(in_state):
    player_test = player("test_name")
    result = []  # on_table, on_hand, played, play_options
    for i in [
            in_state[0:60], in_state[60:120], in_state[120:180],
            in_state[180:240]
    ]:
        result.append(player_test.convertAllCardState(i))
    for j, k in zip(result, ["on_table", "on_hand", "played", "options"]):
        print("\t", k, len(j), j, "\n")
Пример #2
0
 def start(self):
     self.console.start()
     i = 0
     while i < self.num_players:
         name_player = self.console.get_player_name()
         new_player1 = player(name_player,self.default_money)
         self.players.append(new_player1)
         i += 1
             
     self.current_player = randrange(len(self.players))
     self.console.display("{} takes the first turn".format(self.players[self.current_player].name))
     
     while not self.is_complete():
         self.commands=allComands
         self.next_turn()
         
     if not winner == -1:
         self.console.show_winner(winner)
Пример #3
0
def game():

    screenSize = screenWidth, screenHeight = 1000, 600
    screen = pygame.display.set_mode(screenSize)

    player1 = player()

    player2 = player()
    player2.posx = 875

    mainBall = ball()
    mainBall.height = 25
    mainBall.posx = 480
    mainBall.posy = 288

    mainBall.speed()

    while True:

        exit()

        clock = pygame.time.Clock()
        clock.tick(120)

        key = pygame.key.get_pressed()

        player1.move(K_w, K_s, key)
        player1.limit(screenSize)

        player2.move(K_UP, K_DOWN, key)
        player2.limit(screenSize)

        player1.collide(mainBall)
        player2.collide(mainBall)

        mainBall.limit(screenSize)
        mainBall.move()

        ### ajeitar as funcoes de colissao

        if mainBall.posx <= 0:

            mainBall.reset()
            #pygame.time.delay(1000) ###ajeitar isso pq ta travado ate pra fechar o jogo
            player2.score += 1

        elif mainBall.posx + mainBall.width >= screenWidth:

            mainBall.reset()
            #pygame.time.delay(1000)
            player1.score += 1

        if player1.score == 5 or player2.score == 5:
            break

        screen.fill(colors['black'])
        player1.draw(screen)
        player2.draw(screen)
        mainBall.draw(screen)
        text('%d x %d' % (player1.score, player2.score), screen, 45, 480, 60)

        pygame.display.flip()