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 ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //init
- bool c = true; char Change = ' '; char y = ' '; char x = ' ';string Schange;int posx = 0; int posy = 0;
- char[][] board;
- board = new char[10][];
- for (int n = 0; n < 10; n++)
- {
- board[n] = new char[10];
- }
- //set all as blank
- for (int ix = 0; ix < 10; ix++)
- {
- for (int iy = 0; iy < 10; iy++)
- {
- board[ix][iy] = ' ';
- }
- }
- //init end
- while (true)
- {
- Console.WriteLine(" A B C D E F G H I J");
- char posY = 'A';
- for (int ix = 0; ix < 10; ix++)
- {
- Console.Write(posY);
- for (int iy = 0; iy < 10; iy++)
- {
- Console.Write(" " + board[ix][iy]);
- }
- Console.Write("\n");
- posY++;
- }
- //select
- Console.Write("x:");
- var Kx = Console.ReadKey();
- x = char.Parse(Kx.Key.ToString());
- Console.WriteLine("");
- Console.Write("y:");
- var ky = Console.ReadKey();
- y = char.Parse(ky.Key.ToString());
- Console.WriteLine("");
- if(x - 'A' >= 0)
- {
- posx = x - 'A';
- }else if (x - 'a' >= 0)
- {
- posx = x - 'a';
- }
- if (y - 'A' >= 0)
- {
- posy = y - 'A';
- } else if (y- 'a'>= 0)
- {
- posy = y - 'a';
- }
- Console.Write("Vad ska den vara:");
- try
- {
- Change = char.Parse(Console.ReadLine());
- }
- catch (FormatException e)
- {
- Console.WriteLine("Fel format!");
- Change = board[posx][posy];
- }
- board[posx][posy] = Change;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement