Advertisement
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 Triki
- {
- class Program
- {
- static int[,] Tablero = new int[3, 3];
- static bool Jugador = true;
- static void Pintar()
- {
- Console.WriteLine(" 0 1 2");
- for (int i = 0; i < 3; ++i)
- {
- Console.Write(i + " ");
- for (int j = 0; j < 3; ++j)
- {
- switch (Tablero[i, j])
- {
- case 0: Console.Write(". "); break;
- case 1: Console.Write("X "); break;
- case 2: Console.Write("O "); break;
- }
- }
- Console.WriteLine("");
- }
- }
- static void PedirJugada()
- {
- int jugadorActual = Jugador ? 1 : 2;
- Console.WriteLine($"Es el turno del jugador {jugadorActual}");
- Console.WriteLine("Digite una fila: ");
- int f = int.Parse(Console.ReadLine());
- Console.WriteLine("Digite una columna: ");
- int c = int.Parse(Console.ReadLine());
- Tablero[f, c] = jugadorActual;
- }
- static void Main(string[] args)
- {
- while (true)
- {
- Pintar();
- PedirJugada();
- Jugador = !Jugador;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement