Пример #1
0
        private bool invalidKill(IPlayer player, IBoard board, string position)
        {
            if (referee.get_GameState() != "Mill")
            {
                Console.WriteLine("No mill broadcasted");
                return(true);
            }
            if (referee.getcurrentPlayer() == player.currentPlayer())
            {
                Console.WriteLine("Dont kill yourself");
                return(true);
            }
            if (!Board.isValidPosition(position))
            {
                Console.WriteLine("Invalid entry");
                return(true);
            }

            char piece = Board.getPieceAtPos(position);

            //Console.WriteLine(piece);
            if (piece == ' ')
            {
                Console.WriteLine("Empty spot");
                return(true);
            }
            else
            {
                if (player.currentPlayer() == "Black")
                {
                    if (!player.playerOwnPosition(position))
                    {
                        Console.WriteLine("He's no there ?!!!");
                        return(true);
                    }
                    if (cowIn_MillPos(player.getMills(), position) && numberOf_Cow_NotInMill(player) == 0)

                    {
                        return(false);
                    }
                    else if (cowIn_MillPos(player.getMills(), position))
                    {
                        Console.WriteLine("Cannot kill a cow already\n in a mill, try\n another cow");
                        return(true);
                    }
                    return(false);
                }
                else if (player.currentPlayer() == "White")
                {
                    if (cowIn_MillPos(player.getMills(), position) && numberOf_Cow_NotInMill(player) == 0)
                    {
                        Console.WriteLine("Cannot kill a cow already\n in a mill, try\n another cow");
                        return(false);
                    }
                    else if (cowIn_MillPos(player.getMills(), position))

                    {
                        Console.WriteLine("Cannot kill a cow already\n in a mill, try\n another cow");
                        return(true);
                    }

                    return(false);
                }
                else
                {
                    Console.WriteLine("Don't kill yourself, Try again");
                    return(true);
                }
            }
        }