Exemple #1
0
    void Update()
    {
        if (dnd.Action())
        {
            var from = GetSpace(dnd.FromPos);
            var to   = GetSpace(dnd.ToPos);

            string figure = chess.GetFigureAt((int)((dnd.FromPos.x + coordOffset) / 2.0f), (int)((dnd.FromPos.y + coordOffset) / 2.0f)).ToString();
            string move   = figure + from + to;
            chess = chess.Move(move);
            ShowFigues();
        }
    }
Exemple #2
0
    void Update()
    {
        if (dad.Action())
        {
            string from   = GetSquare(dad.pickPosition);
            string to     = GetSquare(dad.dropPosition);
            string figure = chess.GetFigureAt(from);
            string move   = figure + from + to;
            Debug.Log(figure);
            chess = chess.Move(move);

            ShowFigures();
        }
    }
Exemple #3
0
 // Update is called once per frame
 void Update()
 {
     if (dad.Action())
     {
         string from = GetSquare(dad.pickPosition);
         Debug.Log("from :" + from);
         string to = GetSquare(dad.dropPosition);
         Debug.Log("to :" + to);
         string figure = chess.GetFigureAt(GetSquareX(dad.pickPosition), GetSquareY(dad.pickPosition)).ToString();
         Debug.Log("figure :" + figure);
         string move = figure + from + to;
         Debug.Log("Move :" + move);
         chess = chess.Move(move);
         ShowFigures();
     }
 }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        if (dad.Action())
        {
            string from   = GetSquare(dad.pickPosition);
            string to     = GetSquare(dad.putPosition);
            string figure = chess.GetFigureAt(from).ToString();
            string move   = figure + from + to;
            Debug.Log(move);
            //chess = new Chess.Chess(client.SendMove(move).FEN);
            if (isPlaying || !offerDraw)
            {
                MakeMove(move);
            }

            //ShowFigures();
        }
        else if (!dad.isPicking && !makeMove)
        {
            if (yourColor == currentColor)
            {
                MarkValidFigures();
            }
            else
            {
                for (int y = 0; y < 8; y++)
                {
                    for (int x = 0; x < 8; x++)
                    {
                        MarkSquare(x, y, false);
                    }
                }
            }
        }
        else
        {
            if (yourColor == currentColor && !makeMove)
            {
                string from   = GetSquare(dad.pickPosition);
                string figure = chess.GetFigureAt(from).ToString();
                MarkFigureMove(figure + from);
            }
        }
        currentColor = chess.fen.Split()[1] == "w" ? "white" : "black";
    }
Exemple #5
0
    void Update()
    {
        //проверка хода
        if (dad.Action())
        {
            string from = GetSquare(dad.pickPosition);
            string to   = GetSquare(dad.dropPosition);
            //ход
            string figure = chess.GetFigureAt((int)(dad.pickPosition.x / 2.0), (int)(dad.pickPosition.y / 2.0)).ToString();
            string move   = figure + from + to; //Pa2a2 (Pa3a3)
            Debug.Log(move);

            chess = chess.Move(move);
            ShowFigures();
            MarkValidFigures();
        }
        //dad.Action();
    }
Exemple #6
0
 void Update()
 {
     // Если фигура захваченна мышью
     if (dad.Action())
     {
         // С какой клетки
         string from = GetSquare(dad.pickPosition);
         // На какой клете отпущенна
         string to = GetSquare(dad.dropPosition);
         // Какая фигура
         string figure = chess.GetFigureAt(from).ToString();
         // Запись хода в строковом формате (Pe2e4)
         string move = figure + from + to;
         Debug.Log(move);
         // Сделать ход
         chess = new Chess(client.SendMove(move).FEN);
         // Отобразить новую позицию
         ShowFigures();
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (Chess.IsCheckMate || Chess.IsStaleMate)
        {
            return;
        }

        if (!IsBlackMove)
        {
            var bestMove = Solver.FindBestMove(Chess, Constants.DefaultSeachDeath);
            Debug.Log(bestMove);
            Chess = Chess.Move(bestMove);

            ShowFigures();
            MarkSquaresFrom();
            ChangeMoveColor();
        }
        else
        {
            Dad.Action();
        }
    }
Exemple #8
0
 // Update is called once per frame
 void Update()
 {
     dad.Action();
 }