static void Main(string[] args) { Console.SetWindowSize(125, 55); Console.Write("Recuerde: \n\n" + "1) Ingresar los mapas con los siguientes nombres a la carpeta Tarea 2 (la que contiene los archivos .cs): \n" + "\t mapa1 \n" + "\t mapa2 \n" + "\t mapa3 \n" + "\t mapa4 \n\n" + "2) Pulsar 'ENTER' después de cada mensaje (se usó un ReadLine() entre ellos)."); Console.ReadLine(); Console.Clear(); //Creamos las llaves para decriptar, y se las entregamos a la Biblioteca. ILlave[] llaves = new ILlave[4]; llaves[0] = new llaveRoja(); llaves[1] = new llaveVerde(); llaves[2] = new llaveAzul(); llaves[3] = new llaveAmarilla(); BibliotecaT2.Biblioteca.EntregarLlaves(llaves); //Le entregamos a la Biblioteca los paths relativos hacia cada mapa, para que ella los esconda. string[] pathsABitMaps = new string[4]; pathsABitMaps[0] = @"..\..\rsrc\mapa1.BMP"; pathsABitMaps[1] = @"..\..\rsrc\mapa2.BMP"; pathsABitMaps[2] = @"..\..\rsrc\mapa3.BMP"; pathsABitMaps[3] = @"..\..\rsrc\mapa4.BMP"; BibliotecaT2.Biblioteca.EsconderBitmaps(pathsABitMaps); BMP BitMap = new BMP(); Explorador E = new Explorador(); //Iteración que explora cada mapa, y decripta los paths hacia los mapas siguientes. string path = ""; int[,] Map1 = BitMap.BMPToMatrix(@"..\..\rsrc\mapa1.BMP"); for (int i = 1; i < 5; i++) { int[,] Map2 = E.Explorar(Map1); path = BibliotecaT2.Biblioteca.AbrirPuertaRoja() + BibliotecaT2.Biblioteca.AbrirPuertaVerde() + BibliotecaT2.Biblioteca.AbrirPuertaAzul() + BibliotecaT2.Biblioteca.AbrirPuertaAmarilla(); Console.WriteLine("Path Encontrada: \n" + path); Herramientas.PrintIntMap(Map1); BitMap.MatrixToBMP(Map2, i); if (i != 4) Map1 = BitMap.BMPToMatrix(path); } }
public void EncenderAuto(int _iLlave) { if (ValidarLlaveCorrecta(_iLlave)) { Console.WriteLine("La llave es la correcta"); _Auto.EncenderAuto(_iLlave); _Motor = new Motor(); _Motor.EncenderAuto(_iLlave); } else { Console.WriteLine("No es la llave correcta"); } }
public AutoProxy(IAuto _coche, ILlave _Llave) { this.Auto = _coche ?? throw new ArgumentNullException(nameof(_coche)); this.Llave = _Llave ?? throw new ArgumentNullException(nameof(_Llave)); }
static void Main(string[] args) { string[] rutas = new string[4]; rutas[0] = "..\\..\\MapasIniciales\\mapa1.bmp"; rutas[1] = "..\\..\\MapasIniciales\\mapa2.bmp"; rutas[2] = "..\\..\\MapasIniciales\\mapa3.bmp"; rutas[3] = "..\\..\\MapasIniciales\\mapa4.bmp"; Biblioteca.EsconderBitmaps(rutas); LlaveAmarilla llaveAm = new LlaveAmarilla(); LlaveAzul llaveAz = new LlaveAzul(); LlaveRoja llaveRoj = new LlaveRoja(); LlaveVerde llaveVer = new LlaveVerde(); ILlave[] llaves = new ILlave[4]; llaves[0] = llaveRoj; llaves[1] = llaveVer; llaves[2] = llaveAz; llaves[3] = llaveAm; Biblioteca.EntregarLlaves(llaves); Antesala a1 = new Antesala(); a1.mapaAntesala = a1.trabajarConMapa("..\\..\\MapasIniciales\\mapa1.bmp"); Biblioteca.EntregarMapa(a1.mapaAntesala); a1.recorrerMapa0(); int[][,] aDevolver = new int[4][, ]; aDevolver[0] = a1.mapaAntesala; int a = 0; for (int y = 0; y < 4; y++) { if (a < 3) { string roja = Biblioteca.AbrirPuertaRoja(); string amarilla = Biblioteca.AbrirPuertaAmarilla(); string verde = Biblioteca.AbrirPuertaVerde(); string azul = Biblioteca.AbrirPuertaAzul(); a1.mapaAntesala = a1.trabajarConMapa(roja + verde + azul + amarilla); Biblioteca.EntregarMapa(a1.mapaAntesala); aDevolver[a + 1] = a1.recorrerMapa0(); a++; } else { string roja = Biblioteca.AbrirPuertaRoja(); string amarilla = Biblioteca.AbrirPuertaAmarilla(); string verde = Biblioteca.AbrirPuertaVerde(); string azul = Biblioteca.AbrirPuertaAzul(); StreamReader sr2 = new StreamReader(roja + verde + azul + amarilla); string aDescrip = sr2.ReadToEnd(); Console.WindowWidth = 159; Console.WriteLine(" ENCONTRASTE EL TESORO "); Console.WriteLine(aDescrip); } } Program.imprimirMapa(aDevolver[0], 1); Program.imprimirMapa(aDevolver[1], 2); Program.imprimirMapa(aDevolver[2], 3); Program.imprimirMapa(aDevolver[3], 4); Console.ReadKey(); }
public Proxys(ILlave auto) { _Auto = auto; }