Exemple #1
0
    def __init__(self, player_names=['Player1', 'Player2'], debug=False):

        # create player manager
        manager = gsm.GameManager(open={'symbol'}, hidden={'val'})

        super().__init__(debug=debug,
                         manager=manager,
                         stack=TurnPhaseStack(),
                         info_path=os.path.join(MY_PATH, 'info.yaml'))

        # register config files
        self.register_config('basic',
                             os.path.join(MY_PATH, 'config/basics.yaml'))

        # register players
        assert len(player_names) == 2, 'Not the right number of players'
        self.register_player(player_names[0], val=1)
        self.register_player(player_names[1], val=-1)

        # register game object types
        self.register_obj_type(obj_cls=Tick)
        self.register_obj_type(obj_cls=Board)

        # register possible phases
        self.register_phase(name='tic', cls=TicPhase)
Exemple #2
0
	def __init__(self, debug=False):
		
		# create player manager
		manager = gsm.GameManager(open={'symbol'},
		                          hidden={'val'})
		
		super().__init__(debug=debug,
		                 manager=manager)
		
		# register config files
		self.register_config('basic', os.path.join(MY_PATH,'config/basics.yaml'))
		
		# register players
		self.register_player('Player1', val=1)
		self.register_player('Player2', val=-1)
		
		# register game object types
		self.register_obj_type(name='tick',
		                       req={'row', 'col',
		                            'symbol', 'player'},
		                       open={'row', 'col', # all properties are always visible to all players -> full information game
		                             'symbol', 'player'}
		                       )
		
		# register possible phases
		self.register_phase(name='turn', cls=TurnPhase)
Exemple #3
0
    def __init__(self, player_names, debug=False, force_order=False):

        # create player manager
        manager = gsm.GameManager(open={'name', 'hand'})

        stack = TurnPhaseStack()

        log = gsm.GameLogger(indent_level=0)

        super().__init__(
            debug=debug,
            manager=manager,
            stack=stack,
            log=log,
            info_path=os.path.join(MY_PATH, 'info.yaml'),
            player_names=player_names,
            force_order=force_order,
        )

        # register config files
        self.register_config('cards', os.path.join(MY_PATH,
                                                   'config/cards.yaml'))
        self.register_config('rules', os.path.join(MY_PATH,
                                                   'config/rules.yaml'))

        # register game object types
        self.register_obj_type(name='card', obj_cls=Card)
        self.register_obj_type(name='deck52', obj_cls=Deck_WA, open={'count'})
        #self.register_obj_type(name='draw_pile', obj_cls=DrawPile)
        # self.register_obj_type(name='card', obj_cls=CardBase)
        # self.register_obj_type(name='deck', obj_cls=Deck)

        # register possible phases
        self.register_phase(name='phase1', cls=RoyalPhase)
        self.register_phase(name='phase2', cls=ExamplePhase)
Exemple #4
0
    def __init__(self, player_names, debug=False, force_order=False):

        # create player manager
        manager = gsm.GameManager(open={'name', 'hand', 'buildings'})

        stack = TurnPhaseStack()

        log = gsm.GameLogger(indent_level=0)

        super().__init__(
            debug=debug,
            manager=manager,
            stack=stack,
            log=log,
            info_path=os.path.join(MY_PATH, 'info.yaml'),
            player_names=player_names,
            force_order=force_order,
        )

        # register config files
        self.register_config('rules', os.path.join(MY_PATH,
                                                   'config/rules.yaml'))

        # register game object types
        self.register_obj_type(name='card', obj_cls=Card)
        self.register_obj_type(name='special', obj_cls=CustomObj)
        self.register_obj_type(name='normal', )

        # register possible phases
        self.register_phase(name='ExamplePhase', cls=ExamplePhase)
Exemple #5
0
    def __init__(self, player_names, debug=False, shuffle_order=False):

        # create player manager
        manager = gsm.GameManager(open={
            'num_res', 'color', 'devcards', 'buildings', 'reserve', 'ports',
            'past_devcards'
        }, )

        stack = TurnPhaseStack()

        log = gsm.GameLogger(indent_level=0)

        super().__init__(
            debug=debug,
            manager=manager,
            stack=stack,
            log=log,
            info_path=os.path.join(MY_PATH, 'info.yaml'),
            # settings
            shuffle_order=shuffle_order,
            player_names=player_names)

        # register config files
        self.register_config('rules', os.path.join(MY_PATH,
                                                   'config/rules.yaml'))
        self.register_config('dev',
                             os.path.join(MY_PATH, 'config/dev_cards.yaml'))
        self.register_config('map', os.path.join(MY_PATH, 'config/map.yaml'))
        self.register_config('msgs', os.path.join(MY_PATH, 'config/msgs.yaml'))

        # register game object types
        self.register_obj_type(name='board', obj_cls=Board)
        self.register_obj_type(name='hex', obj_cls=Hex)

        self.register_obj_type(
            name='devcard',
            obj_cls=DevCard)  # ,req={'name', 'desc'},) #do not use req
        self.register_obj_type(name='devdeck', obj_cls=Deck)
        self.register_obj_type(name='robber', open={'loc'})

        self.register_obj_type(name='road', open={'loc', 'player'})
        self.register_obj_type(name='settlement', open={'loc', 'player'})
        self.register_obj_type(name='city', open={'loc', 'player'})

        # register possible phases
        self.register_phase(name='setup', cls=SetupPhase)
        self.register_phase(name='main', cls=MainPhase)
        self.register_phase(name='trade', cls=TradePhase)
        self.register_phase(name='robber', cls=RobberPhase)
Exemple #6
0
    def __init__(self, player_names, debug=False, force_order=False):

        # create player manager
        manager = gsm.GameManager(open={'name', 'hand', 'buildings'})

        stack = TurnPhaseStack()

        log = gsm.GameLogger(indent_level=0)

        super().__init__(
            debug=debug,
            manager=manager,
            stack=stack,
            log=log,
            info_path=os.path.join(MY_PATH, 'info.yaml'),
            player_names=player_names,
            force_order=force_order,
        )

        # register config files
        self.register_config('rules', os.path.join(MY_PATH,
                                                   'config/rules.yaml'))
        self.register_config('cards', os.path.join(MY_PATH,
                                                   'config/cards.yaml'))
        self.register_config('msgs', os.path.join(MY_PATH, 'config/msgs.yaml'))

        # register game object types
        self.register_obj_type(name='card',
                               obj_cls=Card,
                               open={'generic_type'})
        self.register_obj_type(name='discard_pile',
                               obj_cls=DiscardPile)  #DiscardPile) ###
        self.register_obj_type(
            name='draw_pile',
            obj_cls=DrawPile,
        )
        self.register_obj_type(name='market', obj_cls=Market)

        # register possible phases
        self.register_phase(name='king', cls=KingPhase)
        self.register_phase(name='queen', cls=QueenPhase)
        self.register_phase(name='jack', cls=JackPhase)

        self.register_phase(name='auction', cls=AuctionPhase)
        self.register_phase(name='ball', cls=BallPhase)
        self.register_phase(name='market', cls=MarketPhase)
        self.register_phase(name='tax', cls=TaxPhase)
        self.register_phase(name='claim', cls=ClaimPhase)