示例#1
0
    def actions(self):
        """Return the sequence of actions applied by this actor.

        >>> from krieg.tictactoe import TicTacToeGame
        >>> game = TicTacToeGame()
        >>> game.players[0].actions
        SequenceView([])
        >>> game.players[1].actions
        SequenceView([])
        >>> game.mark((0, 0), (0, 1), (0, 2))
        <TicTacToeGame>
        >>> game.players[0].actions
        SequenceView([<X: Mark 0, 0>, <X: Mark 0, 2>])
        >>> game.players[1].actions
        SequenceView([<O: Mark 0, 1>])

        :return: The number of actions applied to this game.
        """
        actions = []

        for action in self.game.actions:
            if action.actor == self:
                actions.append(action)

        return SequenceView(actions)
示例#2
0
    def board(self):
        """Return the board of this tic-tac-toe game.

        >>> game = TicTacToeGame()
        >>> for row in game.board:
        ...     print('| ', end='')
        ...     for cell in row:
        ...         print('.' if cell is None else cell, end=' ')
        ...     print('|')
        ...
        | . . . |
        | . . . |
        | . . . |
        >>> game.mark((0, 0), (0, 1), (1, 0))
        <TicTacToeGame>
        >>> for row in game.board:
        ...     print('| ', end='')
        ...     for cell in row:
        ...         print('.' if cell is None else cell, end=' ')
        ...     print('|')
        ...
        | X O . |
        | X . . |
        | . . . |

        :return: The board of this tic-tac-toe game.
        """
        return SequenceView(list(map(SequenceView, self._board)))
示例#3
0
    def seen(self):
        """Return the cards that this poker player have had before in
        his/her hole.

        :return: The seen cards of this poker player.
        """
        return SequenceView(self._seen)
示例#4
0
    def board(self):
        """Return the board of this poker game.

        The board contains the public cards in a poker game. They can be
        combined with individual player's hole cards to create a hand.

        :return: The board of this poker game.
        """
        return SequenceView(self._board)
示例#5
0
    def players(self):
        """Return the players of this game.

        >>> from krieg.tictactoe import TicTacToeGame
        >>> game = TicTacToeGame()
        >>> game.players
        SequenceView([X, O])

        :return: The players of this game.
        """
        return SequenceView(self._players)
示例#6
0
    def actions(self):
        """Return the sequence of actions applied to this game.

        >>> from krieg.tictactoe import TicTacToeGame
        >>> game = TicTacToeGame()
        >>> game.actions
        SequenceView([])
        >>> game.mark((0, 0), (0, 1))
        <TicTacToeGame>
        >>> game.actions
        SequenceView([<X: Mark 0, 0>, <O: Mark 0, 1>])

        :return: The number of actions applied to this game.
        """
        return SequenceView(self._actions)
示例#7
0
    def muck(self):
        """Return the muck of this poker game.

        :return: The muck of this poker game.
        """
        return SequenceView(self._muck)