/ PintarEnConsola.cs
PintarEnConsola.cs
 1  using System;
 2  using System.Collections.Generic;
 3  using System.Linq;
 4  using System.Text;
 5  using System.Threading.Tasks;
 6  
 7  namespace Laberinto
 8  {
 9      public class PintarEnConsola
10      {
11          public static void PintarTablero(Juego tab)
12          {
13              Console.Clear();
14              for (int i = 0; i < tab.Tablero.GetLength(0); i++)
15              {
16                  for (int j = 0; j < tab.Tablero.GetLength(1); j++)
17                  {
18                      if (tab.Tablero[i,j].solucion)
19                      {
20                          Console.Write("·");
21                      }
22                      else if (tab.Tablero[i, j].colisionable)
23                      {
24                          Console.Write("█");
25                      }
26                      else
27                      {
28                          Console.Write(" ");
29                      }
30  
31                  }
32  
33                  Console.Write("\n");
34              }
35          }
36  
37          public static void PintarFicha(Juego tab)
38          {
39              for (int i = 0; i < tab.Tablero.GetLength(0); i++)
40              {
41                  for (int j = 0; j < tab.Tablero.GetLength(1); j++)
42                  {
43                      if (i == tab.Jugador.Posicion[0] && j == tab.Jugador.Posicion[1])
44                      {
45                          Console.SetCursorPosition(j, i);
46                          Console.Write('*');
47                      }
48                  }
49              }
50          }
51  
52          public static void BorrarFicha(Juego tab)
53          {
54              for (int i = 0; i < tab.Tablero.GetLength(0); i++)
55              {
56                  for (int j = 0; j < tab.Tablero.GetLength(1); j++)
57                  {
58                      if (i == tab.Jugador.Posicion[0] && j == tab.Jugador.Posicion[1])
59                      {
60                          Console.SetCursorPosition(j, i);
61                          Console.Write(' ');
62                      }
63                  }
64              }
65          }
66      }
67  }