Пример #1
0
 public NegaMax(Uci uci, TranspTable tabela)
 {
     this.uci       = uci;
     this.avaliador = new Avaliador();
     this.tabela    = tabela;
     age            = 0;
 }
Пример #2
0
 public NegaThread(int id, Board tabuleiro, int profundidade, Avaliador avaliador, Thread temporizador, bool *bParar, ThreadQueue <negaResult> resultados, TranspTable tabela, uint age)
 {
     this.tabuleiro    = tabuleiro.clone();
     this.maxPly       = profundidade;
     this.avaliador    = avaliador;
     this.resultados   = resultados;
     this.temporizador = temporizador;
     this.hits         = 0;
     this.tabela       = tabela;
     this.age          = age;
     this.id           = id;
     unsafe
     {
         this.bParar = bParar;
     }
 }
Пример #3
0
        public static Board lerFen(BlackMagic bm, TranspTable tabela, string fenString)
        {
            int  tipo = 0;
            int  i, j;
            Char c;

            Board tabuleiro = new Board(bm, tabela);

            i = 0;
            int posicao = 0;

            while (i < fenString.Length)
            {
                c = fenString[i++];
                if (c == ' ')
                {
                    tipo++;
                    continue;
                }
                if (tipo == 0)
                {
                    if (c == '/')
                    {
                        continue;
                    }

                    if (Char.IsDigit(c))
                    {
                        posicao += ((int)Char.GetNumericValue(c));
                    }
                    else
                    {
                        for (j = 0; j < bbConstants.PECAS; j++)
                        {
                            if (bbConstants.sPecas[j] == c)
                            {
                                break;
                            }
                        }
                        tabuleiro.addPecaHumana((tipoPeca)j, posicao);
                        posicao++;
                    }
                }
                if (tipo == 1) //roques
                {
                    if (c == 'w')
                    {
                        tabuleiro.corMover = 0;
                    }
                    else
                    {
                        tabuleiro.corMover = 1;
                    }
                }
                if (tipo == 2)
                {
                    switch (c)
                    {
                    case 'q':
                        tabuleiro.potencialRoque |= bbConstants.ROQUE_RAINHA_PRETO;
                        break;

                    case 'Q':
                        tabuleiro.potencialRoque |= bbConstants.ROQUE_RAINHA_BRANCO;
                        break;

                    case 'k':
                        tabuleiro.potencialRoque |= bbConstants.ROQUE_REI_PRETO;
                        break;

                    case 'K':
                        tabuleiro.potencialRoque |= bbConstants.ROQUE_REI_BRANCO;
                        break;

                    case '-':
                        break;
                    }
                }
            }

            return(tabuleiro);
        }
Пример #4
0
 public static Board tabuleiroPadrao(BlackMagic bm, TranspTable tabela)
 {
     return(lerFen(bm, tabela, "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq"));
 }