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


Python Board.initialize_default_board方法代码示例

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


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

示例1: test_can_kill_default_special_board_player_black

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
 def test_can_kill_default_special_board_player_black(self):
     board = Board(6, 4)
     board.initialize_default_board()
     self.assertFalse(board.can_kill(Piece.BLACK))
     self.assertFalse(board.can_be_killed(Piece.WHITE))
     self.assertFalse(board.can_be_killed(Piece.BLACK))
     self.assertFalse(board.can_kill(Piece.WHITE))
开发者ID:jdvr,项目名称:RadikalChess,代码行数:9,代码来源:test.py

示例2: test_save_a_default_game

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
    def test_save_a_default_game(self):
        board = Board(6, 4)
        board.initialize_default_board()
        player_one = Player(Player.IDIOT, Piece.WHITE)
        player_two = Player(Player.IDIOT, Piece.BLACK)
        g_game = Game(player_one, player_two)

        g_game.save(board)
开发者ID:jdvr,项目名称:RadikalChess,代码行数:10,代码来源:test.py

示例3: test_sucessors_for_the_default_board

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
    def test_sucessors_for_the_default_board(self):
        board = Board(6, 4)
        board.initialize_default_board()

        player_one = Player(Player.IDIOT, Piece.BLACK)
        player_two = Player(Player.IDIOT, Piece.WHITE)
        game = Game(player_one, player_two)

        board_copy = copy.deepcopy(board)

        self.assertEqual(board.to_string(), board_copy.to_string())
开发者ID:jdvr,项目名称:RadikalChess,代码行数:13,代码来源:test.py

示例4: game_init

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
    def game_init(self):


        ### CHOOSING PLAYER 1 ###
        print "What kind of player is Player 1 (white)? [h|r|i|f|s]"
        while True:
            user_choose_player = raw_input("where h=human, r=random bot, i=idiot bot, f=figther bot, s=smartest bot: ")
            if user_choose_player == "h":
                player_one = Player(Player.HUMAN, Piece.WHITE)
                break
            if user_choose_player == "r":
                player_one = Player(Player.RANDOM, Piece.WHITE)
                break
            if user_choose_player == "i":
                player_one = Player(Player.IDIOT, Piece.WHITE)
                break
            if user_choose_player == "f":
                player_one = Player(Player.FIGHTER, Piece.WHITE)
                break
            if user_choose_player == "s":
                player_one = Player(Player.SMARTEST, Piece.WHITE)
                break
            print "Wrong input, please, type 'h', 'r', 's', 'f' or 'i' to select a player type"


        ### CHOOSING PLAYER 2 ###
        print "\nWhat kind of player is Player 2 (black)? [h|r|i|f|s]"
        while True:
            user_choose_player = raw_input("where h=human, r=random bot, i=idiot bot, f=figther bot, s=smartest bot: ")
            if user_choose_player == "h":
                player_two = Player(Player.HUMAN, Piece.BLACK)
                break
            if user_choose_player == "r":
                player_two = Player(Player.RANDOM, Piece.BLACK)
                break
            if user_choose_player == "i":
                player_two = Player(Player.IDIOT, Piece.BLACK)
                break
            if user_choose_player == "f":
                player_two = Player(Player.FIGHTER, Piece.BLACK)
                break
            if user_choose_player == "s":
                player_two = Player(Player.SMARTEST, Piece.BLACK)
                break
            print "Wrong input, please, type 'h', 'r', 's', 'f' or 'i' to select a player type"

        ### CREATING THE GAME INSTANCE ###
        game = Game(player_one, player_two)

        ### CHOOSING THE BOARD ###
        print "\nFor Default Board -> d, Black Wins Board -> b, King vs King and rooks -> r "
        while True:
            user_board_select = raw_input()
            if user_board_select == "d":
                board = Board(6, 4)
                board.initialize_default_board()
                print "Default board loaded\n"
                break
            elif user_board_select == "b":
                board = Board(6, 4)
                board.initialize_black_one_move_win()
                print "Black Wins Board\n"
                break
            elif user_board_select == "r":
                board = Board(6, 4)
                board.initialize_king_and_rook()
                print "King vs King and rooks\n"
                break
            print '\nWrong input, please type "y" if you want to load the default or "n" if you want to define it yourself: '

        return [game, board, player_one, player_two]
开发者ID:jdvr,项目名称:RadikalChess,代码行数:73,代码来源:main.py

示例5: test_initialize_default_board

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
 def test_initialize_default_board(self): # Esta correctamente formateado
     board = Board(6, 4)
     board.initialize_default_board()
     self.assertFalse(board.is_empty())
 
     """
开发者ID:jdvr,项目名称:RadikalChess,代码行数:8,代码来源:test.py

示例6: Player

# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import initialize_default_board [as 别名]
__author__ = 'JuanDavid'

from player import Player
from game import Game
from board import Board
from piece import Piece
from aima_method import SeachMethod
from random import randint
from load import Load
import json

p_one = Player(Player.RANDOM, Piece.WHITE)
p_two = Player(Player.SMARTEST, Piece.BLACK)

game = Game(p_one, p_two)
board = Board(6, 4)
board.initialize_default_board()
print "Que empieze el juego"

while game.is_terminal(board) is False:

    posible_movements = game.successors(board, game.get_player_turn())
    search = SeachMethod(SeachMethod.AIMA_ALPHABETA_SEARCH, 1)
    move = search.search(board, game)
    print board.get_piece_in_pos(move[0][0], move[0][1]).to_string()
    board.move_piece(move[0][0], move[0][1], move[1][0], move[1][1])
    game.change_turn()
    print board.to_string()

game.to_db(board, game.get_enemy_player())
开发者ID:jdvr,项目名称:RadikalChess,代码行数:32,代码来源:maintodb.py


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