Beispiel #1
0
    lobby.addPlayerToWaitingList(Player(2, stackSize, "Freddy Mercury"))
    lobby.addPlayerToWaitingList(Player(3, stackSize, "Harry Legg"))
except:
    print("Could not add a player to the lobby")

# Create the table and add the players to the table
tableNumber = 1
numSeats = 10
table = Table(tableNumber, numSeats)

numberOfEmptySeatsAtTable = table.getNumSeats() - table.getNumPlayers()

while (numberOfEmptySeatsAtTable > 0):
    # See if anyone is waiting in the lobby to fill the empty
    # seats
    player = lobby.removeNextPlayerFromWaitingList()
    if (player is not None):
        # add them to the table
        if (table.addPlayerToTable(player)):
            print("Successfully added player " + player.getName() +
                  " to table " + str(table.getTableNumber()))
            numberOfEmptySeatsAtTable = table.getNumSeats(
            ) - table.getNumPlayers()
        else:
            # This should not happen. It's an error
            print("ERROR. was not able to add player" + player.getName() +
                  "to table " + str(table.getTableNumber))
            exit
    else:
        # There are no more players in the lobby
        print(