Пример #1
0
        public ActionResult Get(int id)
        {
            count++;
            int x      = id / 10 - 1;
            int y      = id % 10 - 1;
            int player = count % 2;

            if (Board.board[x, y] == -1)
            {
                Board.board[x, y] = player;
                WinChecker winChecker = new WinChecker();
                if (winChecker.Won(player, x, y))
                {
                    return(Ok("You win"));
                }
            }
            else if (count == Board.board.Length)
            {
                return(Ok("DRAW"));
            }
            else
            {
                return(BadRequest("Place already taken"));
            }

            return(Ok());
        }