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


Python Board.clean方法代码示例

本文整理汇总了Python中board.Board.clean方法的典型用法代码示例。如果您正苦于以下问题:Python Board.clean方法的具体用法?Python Board.clean怎么用?Python Board.clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在board.Board的用法示例。


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

示例1: __init__

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
class Board_administrator:							#Means the dealer
    players = [] #array of Player
    def __init__(self):
        self.board = Board()
        self.deck = Deck()
        self.evaluator = Evaluator()
	
    def cleanBoard(self):
        self.board = Board()
		
    def randomFullBoard(self):
        self.deck.shuffle()
        self.board.clean()
        for i in range(5):
            self.board.addCard(self.deck.draw(1))
			
    def printBoard(self):
        print self.board.printBoard()
                        
    def dealPlayer(self,player):
        player.setHand(self.deck.draw(2))
                        
    def getEquityOnePlayer(self,pairCards):
        return self.evaluator.evaluate(self.board.getBoard(),pairCards)

    def addPlayer(self,player):
        self.players.append(player)

    def dealPlayers(self):
        for player in self.players:
            self.dealPlayer(player)
开发者ID:jorgealemangonzalez,项目名称:Poker_AI,代码行数:33,代码来源:board_administrator.py

示例2: test_valid_moves_border

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_valid_moves_border(self):
     board = Board()
     board.clean()
     king = King(board, Square(0, 0), BLACK)
     expected = [Square(0, 1), Square(1, 0), Square(1, 1)]
     result = king.valid_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:9,代码来源:test_king.py

示例3: test_attacks_north

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_attacks_north(self):
     board = Board()
     board.clean() 
     board.matrix[3][2] = "P"
     king = King(board, Square(4, 2), WHITE)
     expected = [Square(3, 2)]
     result = king.attacking_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:10,代码来源:test_king.py

示例4: test_valid_moves_clean_board

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_valid_moves_clean_board(self):
     board = Board()
     board.clean()
     king = King(board, Square(4, 4), BLACK)
     expected = [Square(3, 3), Square(3, 4), Square(3, 5),
                 Square(4, 3), Square(4, 5),
                 Square(5, 3), Square(5, 4), Square(5, 5)]
     result = king.valid_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:11,代码来源:test_king.py

示例5: test_attacking_moves

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_attacking_moves(self):
     b = Board()
     b.clean()
     b.matrix[4][7] = "p"
     b.matrix[1][2] = "P"
     b.matrix[4][1] = "p"
     rook = Rook(b, Square(4, 2), BLACK)
     expected = [Square(4, 1), Square(4, 7)]
     result = rook.attacking_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:12,代码来源:test_rook.py

示例6: test_attacking_being_added_to_valid_moves

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_attacking_being_added_to_valid_moves(self):
     b = Board()
     b.clean()
     b.matrix[3][4] = "P"
     rook = Rook(b, Square(3, 3), WHITE) 
     expected = [Square(2, 3), Square(1, 3), Square(0, 3),
                 Square(4, 3), Square(5, 3), Square(6, 3),
                 Square(7, 3), Square(3, 2), Square(3, 1),
                 Square(3, 0), Square(3, 4)]
     result = rook.valid_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:13,代码来源:test_rook.py

示例7: test_valid_moves_clean_board

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_valid_moves_clean_board(self):
     b = Board()
     b.clean()
     rook = Rook(b, Square(4, 2), WHITE)
     expected = [Square(3, 2), Square(2, 2), Square(1, 2),
                 Square(0, 2), Square(5, 2), Square(6, 2),
                 Square(7, 2), Square(4, 1), Square(4, 0),
                 Square(4, 3), Square(4, 4), Square(4, 5),
                 Square(4, 6), Square(4, 7)]
     result = rook.valid_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:13,代码来源:test_rook.py

示例8: test_valid_moves_with_other_pieces

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_valid_moves_with_other_pieces(self):
     board = Board()
     board.clean()
     board.matrix[1][1] = 'P'
     board.matrix[1][2] = 'P'
     board.matrix[2][3] = 'b'
     king = King(board, Square(2, 2), WHITE)
     expected = [Square(1, 3), Square(2, 1), Square(3, 1), 
                 Square(3, 2),Square(3, 3), Square(1, 1),
                 Square(1, 2)]
     result = king.valid_moves()
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:14,代码来源:test_king.py

示例9: test_clean

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import clean [as 别名]
 def test_clean(self):
     b = Board()
     expected = 64
     b.clean()
     result = b.to_flat(b.matrix).count(EMPTY)
     self.assertEqual(expected, result)
开发者ID:cathoderay,项目名称:chess,代码行数:8,代码来源:test_board.py


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