当前位置: 首页>>代码示例>>Python>>正文


Python state.State类代码示例

本文整理汇总了Python中giles.state.State的典型用法代码示例。如果您正苦于以下问题:Python State类的具体用法?Python State怎么用?Python State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, server, table_name):

        super(CaptureGo, self).__init__(server, table_name)

        self.game_display_name = "Capture Go"
        self.game_name = "capturego"
        self.seats = [
            Seat("Black"),
            Seat("White")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RCapture Go^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Capture Go-specific stuff.
        self.turn = None
        self.seats[0].data.side = BLACK
        self.seats[1].data.side = WHITE
        self.seats[0].data.capture_list = []
        self.seats[1].data.capture_list = []
        self.capture_goal = 1
        self.resigner = None
        self.turn_number = 0
        self.goban = giles.games.goban.Goban()
开发者ID:Cloudxtreme,项目名称:giles,代码行数:26,代码来源:capture_go.py

示例2: __init__

    def __init__(self, server, table_name):

        super(Tanbo, self).__init__(server, table_name)

        self.game_display_name = "Tanbo"
        self.game_name = "tanbo"
        self.seats = [
            Seat("Black"),
            Seat("White"),
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RTanbo^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Tanbo-specific stuff.
        self.size = 19
        self.turn = None
        self.black = self.seats[0]
        self.black.data.seat_str = "^KBlack^~"
        self.black.data.root_list = []
        self.white = self.seats[1]
        self.white.data.seat_str = "^WWhite^~"
        self.white.data.root_list = []
        self.resigner = None
        self.layout = None

        # Initialize the starting layout.
        self.init_layout()
开发者ID:sunfall,项目名称:giles,代码行数:30,代码来源:tanbo.py

示例3: __init__

    def __init__(self, server, table_name):

        super(Ataxx, self).__init__(server, table_name)

        self.game_display_name = "Ataxx"
        self.game_name = "ataxx"
        self.seats = [
            Seat("Red"),
            Seat("Blue"),
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RAtaxx^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Ataxx-specific stuff.
        self.board = None
        self.printable_board = None
        self.sides = {}
        self.size = 7
        self.player_mode = 2
        self.turn = None
        self.last_r = None
        self.last_c = None

        self.init_seats()
        self.init_board()
开发者ID:Cloudxtreme,项目名称:giles,代码行数:28,代码来源:ataxx.py

示例4: __init__

    def __init__(self, server, table_name):

        super(Gonnect, self).__init__(server, table_name)

        self.game_display_name = "Gonnect"
        self.game_name = "gonnect"
        self.seats = [
            Seat("Black"),
            Seat("White")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RGonnect^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Gonnect-specific stuff.
        self.turn = None
        self.seats[0].data.side = BLACK
        self.seats[0].data.dir_str = "/Vertical"
        self.seats[1].data.side = WHITE
        self.seats[1].data.dir_str = "/Horizontal"
        self.directional = False
        self.resigner = None
        self.turn_number = 0
        self.goban = giles.games.goban.Goban()
        self.adjacency_map = None
        self.found_winner = False

        # A traditional Gonnect board is 13x13.
        self.goban.resize(13, 13)
开发者ID:sunfall,项目名称:giles,代码行数:31,代码来源:gonnect.py

示例5: __init__

    def __init__(self, server, table_name):

        super(Breakthrough, self).__init__(server, table_name)

        self.game_display_name = "Breakthrough"
        self.game_name = "breakthrough"
        self.seats = [
            Seat("Black"),
            Seat("White")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RBreakthrough^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Breakthrough-specific stuff.
        self.width = 8
        self.height = 8
        self.turn = None
        self.black = self.seats[0]
        self.white = self.seats[1]
        self.resigner = None
        self.layout = None

        # We cheat and create a black and white piece here.  Breakthrough
        # doesn't differentiate between pieces, so this allows us to do
        # comparisons later.
        self.bp = Piece("^K", "b", "B")
        self.bp.data.owner = self.black
        self.wp = Piece("^W", "w", "W")
        self.wp.data.owner = self.white

        self.init_board()
开发者ID:Cloudxtreme,项目名称:giles,代码行数:34,代码来源:breakthrough.py

示例6: __init__

    def __init__(self, server, table_name):

        super(SquareOust, self).__init__(server, table_name)

        self.game_display_name = "Square Oust"
        self.game_name = "square_oust"
        self.seats = [
            Seat("Black"),
            Seat("White"),
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RSquare Oust^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Square Oust-specific stuff.
        self.height = 11
        self.width = 11
        self.turn = None
        self.black = self.seats[0]
        self.black.data.seat_str = "^KBlack^~"
        self.black.data.groups = []
        self.black.data.made_move = False
        self.white = self.seats[1]
        self.white.data.seat_str = "^WWhite^~"
        self.white.data.groups = []
        self.white.data.made_move = False
        self.resigner = None
        self.layout = None
        self.move_was_capture = False

        # Initialize the starting layout.
        self.init_layout()
开发者ID:sunfall,项目名称:giles,代码行数:34,代码来源:square_oust.py

示例7: __init__

    def __init__(self, server, table_name):

        super(Crossway, self).__init__(server, table_name)

        self.game_display_name = "Crossway"
        self.game_name = "crossway"
        self.seats = [
            Seat("Black"),
            Seat("White")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RCrossway^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Crossway-specific stuff.
        self.board = None
        self.printable_board = None
        self.size = 19
        self.turn = None
        self.turn_number = 0
        self.seats[0].data.side = BLACK
        self.seats[1].data.side = WHITE
        self.last_r = None
        self.last_c = None
        self.resigner = None
        self.adjacency_map = None
        self.found_winner = False

        self.init_board()
开发者ID:sunfall,项目名称:giles,代码行数:31,代码来源:crossway.py

示例8: __init__

    def __init__(self, server, table_name):

        super(Talpa, self).__init__(server, table_name)

        self.game_display_name = "Talpa"
        self.game_name = "talpa"
        self.seats = [Seat("Red"), Seat("Blue")]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RTalpa^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Talpa-specific stuff.
        self.size = 8
        self.turn = None
        self.red = self.seats[0]
        self.red.data.seat_str = "^RRed/Vertical^~"
        self.blue = self.seats[1]
        self.blue.data.seat_str = "^BBlue/Horizontal^~"
        self.resigner = None
        self.layout = None

        # Like in most connection games, there is no difference between pieces
        # of a given color, so we save time and create our singleton pieces
        # here.
        self.rp = Piece("^R", "x", "X")
        self.rp.data.owner = self.red
        self.bp = Piece("^B", "o", "O")
        self.bp.data.owner = self.blue

        # Initialize the starting layout.
        self.init_layout()
开发者ID:sunfall,项目名称:giles,代码行数:33,代码来源:talpa.py

示例9: __init__

    def __init__(self, server, table_name):

        super(Hokm, self).__init__(server, table_name)

        self.game_display_name = "Hokm"
        self.game_name = "hokm"

        self.state = State("need_players")
        self.prefix = "(^RHokm^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Hokm-specific stuff.
        self.goal = 7
        self.trick = None
        self.trump_suit = None
        self.led_suit = None
        self.turn = None
        self.dealer = None
        self.hakem = None
        self.winner = None

        # Default to four-player mode.
        self.mode = 4
        self.short = True
        self.setup_mode()
开发者ID:Cloudxtreme,项目名称:giles,代码行数:25,代码来源:hokm.py

示例10: __init__

    def __init__(self, server, table_name):

        super(Metamorphosis, self).__init__(server, table_name)

        self.game_display_name = "Metamorphosis"
        self.game_name = "metamorphosis"
        self.seats = [
            Seat("Black"),
            Seat("White")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RMetamorphosis^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Metamorphosis-specific stuff.
        self.board = None
        self.printable_board = None
        self.size = 12
        self.ko_fight = True
        self.group_count = None
        self.turn = None
        self.turn_number = 0
        self.seats[0].data.side = BLACK
        self.seats[0].data.last_was_ko = False
        self.seats[1].data.side = WHITE
        self.seats[1].data.last_was_ko = False
        self.last_r = None
        self.last_c = None
        self.resigner = None
        self.adjacency_map = None
        self.found_winner = False

        self.init_board()
开发者ID:sunfall,项目名称:giles,代码行数:35,代码来源:metamorphosis.py

示例11: __init__

    def __init__(self, server, table_name):

        super(Poison, self).__init__(server, table_name)

        self.game_display_name = "Poison"
        self.game_name = "poison"
        self.seats = [
            Seat("Alpha"),
            Seat("Bravo"),
            Seat("Charlie"),
            Seat("Delta"),
            Seat("Echo"),
            Seat("Foxtrot"),
            Seat("Golf"),
            Seat("Hotel"),
            Seat("India"),
            Seat("Juliet")
        ]
        self.state = State("need_players")
        self.prefix = "(^RPoison^~) "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)
        self.min_players = 3
        self.max_players = 10

        # Default configuration.
        self.antidote_count = 3
        self.poison_count = 1
        self.goal = 2

        # Mutable information.
        self.turn = None
        self.highest_bidder = None
开发者ID:sunfall,项目名称:giles,代码行数:32,代码来源:poison.py

示例12: __init__

    def __init__(self, server, table_name):

        super(FortyOne, self).__init__(server, table_name)

        self.game_display_name = "Forty-One"
        self.game_name = "fortyone"

        # Seat ordering is "Persian."
        self.seats = [
            Seat("North"),
            Seat("West"),
            Seat("South"),
            Seat("East"),
        ]

        self.min_players = 4
        self.max_players = 4
        self.state = State("need_players")
        self.prefix = "(^RForty-One^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # 41-specific stuff.
        self.goal = 41
        self.double = 7
        self.minimum = 11
        self.whist = False
        self.positive = True
        self.trick = None
        self.trump_suit = None
        self.led_suit = None
        self.turn = None
        self.dealer = None
        self.winner = None

        self.north = self.seats[0]
        self.west = self.seats[1]
        self.south = self.seats[2]
        self.east = self.seats[3]

        self.north.data.who = NORTH
        self.west.data.who = WEST
        self.south.data.who = SOUTH
        self.east.data.who = EAST

        self.north.data.partner = self.south
        self.west.data.partner = self.east
        self.south.data.partner = self.north
        self.east.data.partner = self.west

        self.layout = FourPlayerCardGameLayout()

        # Set everyone's score to zero.
        for seat in self.seats:
            seat.data.score = 0
开发者ID:sunfall,项目名称:giles,代码行数:54,代码来源:forty_one.py

示例13: __init__

    def __init__(self, server, table_name):

        super(Expeditions, self).__init__(server, table_name)

        self.game_display_name = "Expeditions"
        self.game_name = "expeditions"
        self.seats = [
            Seat("Left"),
            Seat("Right")
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RExpeditions^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Expeditions-specific stuff.
        self.suit_count = 5
        self.agreement_count = 3
        self.penalty = 20
        self.bonus = True
        self.bonus_length = 8
        self.bonus_points = 20
        self.hand_size = 8
        self.goal = 1

        self.turn = None
        self.draw_pile = None
        self.discards = []
        self.left = self.seats[0]
        self.right = self.seats[1]
        self.left.data.side = LEFT
        self.left.data.curr_score = 0
        self.left.data.overall_score = 0
        self.left.data.hand = None
        self.left.data.expeditions = []
        self.right.data.side = RIGHT
        self.right.data.curr_score = 0
        self.right.data.overall_score = 0
        self.right.data.hand = None
        self.right.data.expeditions = []
        self.resigner = None
        self.first_player = None
        self.just_discarded_to = None

        self.printable_layout = None
        self.init_hand()
开发者ID:sunfall,项目名称:giles,代码行数:47,代码来源:expeditions.py

示例14: __init__

    def __init__(self, server, table_name):

        super(Redstone, self).__init__(server, table_name)

        self.game_display_name = "Redstone"
        self.game_name = "redstone"
        self.seats = [
            Seat("Black"),
            Seat("White"),
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.prefix = "(^RRedstone^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # Redstone-specific stuff.
        self.height = 19
        self.width = 19
        self.turn = None
        self.black = self.seats[0]
        self.black.data.seat_str = "^KBlack^~"
        self.black.data.made_move = False
        self.white = self.seats[1]
        self.white.data.seat_str = "^WWhite^~"
        self.white.data.made_move = False
        self.resigner = None
        self.layout = None

        # Like most abstracts, Redstone doesn't need to differentiate between
        # the pieces on the board.
        self.bp = Piece("^K", "x", "X")
        self.bp.data.owner = self.black
        self.black.data.piece = self.bp
        self.wp = Piece("^W", "o", "O")
        self.wp.data.owner = self.white
        self.white.data.piece = self.wp
        self.rp = Piece("^R", "r", "R")
        self.rp.data.owner = None

        # Initialize the starting layout.
        self.init_layout()
开发者ID:Cloudxtreme,项目名称:giles,代码行数:42,代码来源:redstone.py

示例15: __init__

    def __init__(self, server, table_name):

        super(RockPaperScissors, self).__init__(server, table_name)

        self.game_display_name = "Rock-Paper-Scissors"
        self.game_name = "rps"
        self.seats = [
            Seat("Left"),
            Seat("Right"),
        ]
        self.min_players = 2
        self.max_players = 2
        self.state = State("need_players")
        self.plays = [None, None]
        self.prefix = "(^RRPS^~): "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)

        # RPS requires both seats, so may as well mark them active.
        self.seats[0].active = True
        self.seats[1].active = True
开发者ID:sunfall,项目名称:giles,代码行数:20,代码来源:rock_paper_scissors.py


注:本文中的giles.state.State类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。