Example #1
0
        public bool MoveVeiculo(IElement[,] terreno, Veiculo motinha, Tesouro tesouro, List <Veiculo> veiculos)
        {
            bool teste = false;

            rnd            = new Random();
            int[,] sentido = QualADirecao();
            if (VerificaParede(terreno, motinha, sentido) == true)
            {
                if (VerificaTesouro(terreno, motinha, sentido, tesouro) == true)
                {
                    if (VerificaVeiculo(terreno, motinha, sentido, veiculos) == true)
                    {
                        Move(terreno, motinha, sentido);
                    }
                }
                else if (VerificaTesouro(terreno, motinha, sentido, tesouro) == false)
                {
                    Move(terreno, motinha, sentido);
                    teste = true;
                    return(teste);
                }
            }
            return(teste);
        }
Example #2
0
        public bool VerificaTesouro(IElement[,] terreno, Veiculo motinha, int[,] sentido, Tesouro tesouro)

        {
            bool teste = true;;

            if (sentido[0, 1] != 0) //E W
            {
                if (terreno[motinha.YPos, motinha.XPos + sentido[0, 1] * QuantidadeMov] == tesouro)
                {
                    teste = false;
                }
            }
            else if (sentido[1, 0] != 0) //S N
            {
                if (terreno[motinha.YPos + sentido[1, 0] * QuantidadeMov, motinha.XPos] == tesouro)
                {
                    teste = false;
                }
            }
            return(teste);
        }