Skip to content

Instantly share code, notes, and snippets.

@Sprite105
Created November 26, 2015 09:08
Show Gist options
  • Save Sprite105/d7c5814401ddc94ea802 to your computer and use it in GitHub Desktop.
Save Sprite105/d7c5814401ddc94ea802 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Class1
{
private int num = 0;
private char[,] mas;
public void func(int n) {
num = n;
mas = new char[n, num];
board(mas);
}
private void board(char[,] mas) {
Console.Write(" ");
for (int i = 0; i < num; i++)
if (i < 9) Console.Write(" " + (i + 1) + " "); else Console.Write(" " + (i + 1));
Console.WriteLine("\n");
for (int i = 0; i < num; i++) {
if (i > 8) Console.Write(i + 1 + " "); else Console.Write(" " + (i + 1) + " ");
for (int j = 0; j < num; j++) {
if ((((j + 1) + (i + 1)) % 2) == 0) Console.BackgroundColor = ConsoleColor.White;
else Console.BackgroundColor = ConsoleColor.Black;
Console.Write(mas[i, j] + " "); Console.ResetColor();
} Console.WriteLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment