Exemplo n.º 1
0
        private float[] BoardToNetworkInput(BoardRepresentation currentBoard)
        {
            int Idx = 0;

            float[] board = new float[196];

            for (int i = 1; i < 25; i++)
            {
                int pieces = currentBoard.GetPiecesAt(i);

                if (pieces == 0)
                {
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == 1)
                {
                    board[Idx++] = 1;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == 2)
                {
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == 3)
                {
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 0;

                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces > 3)
                {
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = (pieces - 3) / 2.0f;

                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == -1)
                {
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 1;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == -2)
                {
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                }
                else if (pieces == -3)
                {
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 0;
                }
                else if (pieces < -3)
                {
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;
                    board[Idx++] = 0;

                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = 1;
                    board[Idx++] = (-pieces - 3) / 2.0f;;
                }
            }

            board[Idx++] = currentBoard.GetPiecesAt(25) / 2.0f;
            board[Idx++] = -currentBoard.GetPiecesAt(0) / 2.0f;

            board[Idx++] = currentBoard.BearOffCountCurrent() / 15.0f;
            board[Idx++] = -currentBoard.BearOffCountOpponent() / 15.0f;

            return(board);
        }
Exemplo n.º 2
0
    public override LinguisticInputValue CreateLinguisticInputValue(BoardRepresentation board)
    {
        LinguisticInputValue result = new LinguisticInputValue(GetName(), board.BearOffCountCurrent());

        return(result);
    }