def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.game.game_variant = GameVariantGrand() self.game.players[0].type = Player.Type.DEFENDER self.game.players[1].type = Player.Type.DECLARER self.game.players[2].type = Player.Type.DEFENDER self.game.trick.leader = self.game.players[1] self.state = GameStatePlay(self.game) self.state_machine = GameStateMachine(self.state)
def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state_machine = GameStateMachine(self.state)
def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.state = GameStateBid(self.game) self.state.current_bid_state = BidStateResponseTurn(self.game) self.state.current_bid_state.state_finished_handler = self.state.bid_state_finished_handler self.state_machine = GameStateMachine(self.state)
from game.game import Game from game.game_state_machine import GameStateMachine from game.game_variant import GameVariantGrand from game.state.game_state_bid import BidCallAction, BidAcceptAction, BidPassAction, PickUpSkatAction, \ PutDownSkatAction, \ DeclareGameVariantAction from game.state.game_state_play import PlayCardAction from game.state.game_state_start import GameStateStart, StartGameAction from model.card import Card from model.player import Player player1 = Player(1, "Alice") player2 = Player(2, "Bob") player3 = Player(3, "Carol") game = Game([player1, player2, player3]) state_machine = GameStateMachine(GameStateStart(game)) # ------------------------------------------------------------ # Simulate a game # ------------------------------------------------------------ print("Start game") state_machine.handle_action(StartGameAction()) print("\nDealer=" + game.get_dealer().name) print("First_Seat=" + game.get_first_seat().name + " " + str(game.get_first_seat().cards)) print("Second_Seat=" + game.get_second_seat().name + " " + str(game.get_second_seat().cards)) print("Third_Seat=" + game.get_third_seat().name + " " + str(game.get_third_seat().cards)) print("Skat=" + str(game.skat)) # call from carol print("\n" + player3.name + " bids 18")
def setUp(self): self.game = Game([Player(1, "P1"), Player(2, "P2"), Player(3, "P3")]) self.game.round = 10 # TODO set up finished game self.state = GameStateEnd(self.game) self.state_machine = GameStateMachine(self.state)