示例#1
0
        public ctlUIChessBoard()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call
            this.chessgame             = null;
            this.penborders            = new Pen(Color.Black, 1);
            this.whitesquarebrush      = new SolidBrush(Color.MintCream);
            this.blacksquarebrush      = new SolidBrush(Color.Wheat);
            this.blackboardtextbrush   = new SolidBrush(Color.Black);
            this.redboardtextbrush     = new SolidBrush(Color.Red);
            this.boardblackthreatbrush = new SolidBrush(Color.Red);
            this.boardwhitethreatbrush = new SolidBrush(Color.Blue);
            this.boardlegalmovebrush   = new SolidBrush(Color.Blue);
            this.movingpiece           = Chess.ChessPiece.EMPTY;
            this.arialfont             = new Font("Arial", 6.5F);

            //create a memory bitmap buffer...
            //this.CreateDoubleBuffer(513,513);
            //this.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);

            this.SetStyle(ControlStyles.DoubleBuffer |
                          ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);



            /*
             * this.tlTip.SetToolTip(this,
             *      "NONE=		0\n"+
             *      "DIRECT=	1\n"+
             *      "NORTH=		2\n"+
             *      "SOUTH=		4\n"+
             *      "EAST=		8\n"+
             *      "WEST=		16\n"+
             *      "NORTHEAST=	32\n"+
             *      "NORTHWEST=	64\n"+
             *      "SOUTHEAST=	128\n"+
             *      "SOUTHWEST=	256");
             *
             */

            //debug stuff
//			this.chessgame = new ChessGame();
//			this.chessgame.NewGame(Chess.Side.WHITE);
//			for(int count=0;count < 8;count++)
//			{
//				this.chessgame.board[count,6].chesspiece= Chess.ChessPiece.EMPTY;
//				this.chessgame.board[count,7].chesspiece= Chess.ChessPiece.EMPTY;
//			}
//
//			this.chessgame.board[4,4].chesspiece = Chess.ChessPiece.WHITEKING   ;
//			this.chessgame.SetAllBoardThreats(this.chessgame.board);
//			this.movingpiece=ChessPiece.EMPTY;
//			this.paintBlackThreats=false;
//			this.paintWhiteThreats=false;

//			this.paintBlackThreats=true;
//			this.paintWhiteThreats=true;
        }
示例#2
0
 public ArtificialIntelligence(ChessGame chessGame)
 {
     this.chessGame = chessGame;
     this.gameTree  = new GameState(null,
                                    ChessGame.CopyBoard(this.chessGame.Board),
                                    this.chessGame.GetTurn());
     this.sideAI = ChessGame.Computer;
 }
示例#3
0
 private void NewGame()
 {
     this.chessgame = new ChessGame();
     this.chessgame.GameMoveEvent += new Chess.ChessGame.GameMoveEventHandler(chessgame_GameMoveEvent);
     this.chessgame.NewGame(Side.WHITE);
     this.ClearMoveHistory();
     this.UIChessBoard.chessgame = this.chessgame;
     this.UIChessBoard.Invalidate();
 }
示例#4
0
        public dlgPawnPromotion(ChessGame chessGame)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.chessGame = chessGame;
        }
示例#5
0
文件: Board.cs 项目: t3dodson/chess
 public Board(ChessGame game, int sideLength)
 {
     SideLength = sideLength;
     Grid = new ChessPiece[8, 8];
     WhiteTeam = new Team(Color.White, this);
     BlackTeam = new Team(Color.Black, this);
     foreach (var i in Enumerable.Range(0, 7))
     {
         foreach (var j in Enumerable.Range(0, 7))
         {
             Grid[i, j] = null;
         }
     }
     foreach (var piece in WhiteTeam.Pieces)
     {
         Grid[piece.Location.X, piece.Location.Y] = piece;
     }
     foreach (var piece in BlackTeam.Pieces)
     {
         Grid[piece.Location.X, piece.Location.Y] = piece;
     }
 }
示例#6
0
 public King(Board board, Color color, ChessGame game) : base(board, color)
 {
     _game = game;
 }
示例#7
0
 public void setChessGame(ChessGame chessGame)
 {
     this.chessgame = chessGame;
 }