Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Viernes
- {
- class Program
- {
- static void Main(string[] args)
- {
- int xDig = 0, yDig = 0;
- char pCardeal = 'N';
- //coordenadas
- Console.Write("Digite as coordenadas \nx: ");
- xDig = Convert.ToInt32(Console.ReadLine());
- Console.Write("y: ");
- yDig = Convert.ToInt32(Console.ReadLine());
- Console.Write("Cardeal 'N' 'S' 'L' 'O': ");
- pCardeal = Convert.ToChar(Console.Read());
- pCardeal = Char.ToUpper(pCardeal);
- //Comandos
- Console.WriteLine("Digite alguns comandos, 'E'squerda, 'D'ireita, 'A'vançar.");
- string comandos = Console.ReadLine();
- comandos = comandos.ToUpper();
- char[] Comands = comandos.ToCharArray();
- //Obj
- SpaceCar sp = new SpaceCar(xDig, yDig, pCardeal);
- foreach (var separaLetras in Comands)
- {
- switch (separaLetras)
- {
- case 'E':
- sp.girarEsquerda();
- break;
- case 'D':
- sp.girarDireita();
- break;
- case 'A':
- sp.avancarBloco(xDig, yDig);
- break;
- }
- }
- //Imprimindo Destino
- Console.Write("Coordenadas: {0} {1} {2}", sp.PosicaoX,sp.PosicaoY, sp.PosicaoCardial);
- Console.WriteLine("\nPress Any Key to Exit");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment