コード例 #1
0
ファイル: ZertzBoardTest.cs プロジェクト: KommuSoft/Zertz
        private ZertzBoard buildSampleBoard2()
        {
            HexLocation[] hls;
            ZertzBoard    board = ZertzBoard.OffsetBoard(out hls);
            ZertzPiece    dead  = ZertzPiece.Dead;
            ZertzPiece    blac  = ZertzPiece.Vacant;

            blac.PutBall(ZertzBallType.Black);
            ZertzPiece gray = ZertzPiece.Vacant;

            gray.PutBall(ZertzBallType.Gray);
            ZertzPiece whit = ZertzPiece.Vacant;

            whit.PutBall(ZertzBallType.White);
            board[0x00, 0x03] = dead;
            board[0x00, 0x06] = dead;
            board[0x01, 0x06] = dead;
            board[0x02, 0x06] = dead;
            board[0x03, 0x06] = dead;
            board[0x05, 0x02] = dead;
            board[0x06, 0x02] = dead;
            board[0x06, 0x01] = dead;
            board[0x03, 0x05] = dead;
            board[0x04, 0x05] = dead;
            board[0x04, 0x04] = dead;
            board[0x05, 0x04] = dead;
            board[0x05, 0x03] = dead;
            board[0x06, 0x03] = dead;
            board[0x01, 0x03] = whit;
            board[0x02, 0x04] = whit;
            board[0x02, 0x03] = gray;
            board[0x05, 0x00] = gray;
            board[0x03, 0x01] = blac;
            return(board);
        }
コード例 #2
0
        public void PutZertzBall(HexLocation hl, ZertzBallType type)           //PZB
        {
            ZertzPiece piece = ZertzPiece.Vacant;

            piece.PutBall(type);
            this[hl] = piece;
        }
コード例 #3
0
ファイル: ZertzBoardTest.cs プロジェクト: KommuSoft/Zertz
        private ZertzBoard buildSampleBoard9()
        {
            HexLocation[] hls;
            ZertzBoard    board = ZertzBoard.OffsetBoard(out hls);
            ZertzPiece    blac  = ZertzPiece.Vacant;

            blac.PutBall(ZertzBallType.Black);
            for (int i = 0x00; i < 0x07; i++)
            {
                for (int j = 0x00; j < 0x07; j++)
                {
                    if (board[i, j].IsAlive)
                    {
                        board[i, j] = blac;
                    }
                }
            }
            return(board);
        }
コード例 #4
0
        public ZertzBallType DoHopMove(HexLocation zl, HexDirection dir)
        {
            HexLocation hldir = HexLocation.NeighbourDirections[(byte)dir];
            HexLocation zla = zl, zlb = zla + hldir, zlc = zlb + hldir;
            //if(this[zla].CanDropBall() && this[zlb].CanDropBall() && this[zlc].CanPutBall()) {
            ZertzPiece zpa = this[zla];
            ZertzPiece zpb = this[zlb];
            ZertzPiece zpc = this[zlc];

            zpc.PutBall(zpa.DropBall());
            ZertzBallType t = zpb.DropBall();

            this[zla] = zpa;
            this[zlb] = zpb;
            this[zlc] = zpc;
            return(t);
            //}
            //throw new InvalidZertzActionException(String.Format("Can't perform this hop operation: [{0}:{1}]",zl,dir));
        }