Esempio n. 1
0
        // detects if a move has been made and checks if the move is allowed
        public bool Detect(Board board, string move)
        {
            if (move.Length == 2 && ("0123456789".Contains(move[1].ToString())))
            {
                if (!board.Contains(move) && isValidRow(move))
                {
                    board.Add(move);
                    return(true);
                }

                else
                {
                    Console.WriteLine("Shot already taken!!");
                    return(false);
                }
            }

            else
            {
                Console.WriteLine("Unknown column number, please insert valid column number from 0-10!!");
                return(false);
            }
        }