stefan1919

Game of Life/started

Aug 29th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] matrix = new int[10, 10];
  14.             int n = int.Parse(Console.ReadLine());
  15.             List<int> coordinates = new List<int>();
  16.             int counterInput = 0;
  17.             int marker = 0;
  18.             int input;
  19.             while (counterInput <= 2 * n - 1)
  20.             {
  21.                 input = int.Parse(Console.ReadLine());
  22.                 coordinates.Add(input);
  23.                 counterInput++;
  24.             }
  25.             int matrixDraw = 0;
  26.             for (int i = 0; i < 2 * n - 1; i++)
  27.             {
  28.                 if (i % 2 == 0)
  29.                 {
  30.                     int x = coordinates[i];
  31.                     int y = coordinates[i + 1];
  32.                     if (y == 9)
  33.                     {
  34.                         y = 0;
  35.                         matrix[x, y] = 1;
  36.                         continue;
  37.                     }
  38.                     if (y == 8)
  39.                     {
  40.                         y = 1;
  41.                         matrix[x, y] = 1;
  42.                         continue;
  43.                     }
  44.                     if (y == 7)
  45.                     {
  46.                         y = 2;
  47.                         matrix[x, y] = 1;
  48.                         continue;
  49.                     }
  50.                     if (y == 6)
  51.                     {
  52.                         y = 3;
  53.                         matrix[x, y] = 1;
  54.                         continue;
  55.                     }
  56.                     if (y == 5)
  57.                     {
  58.                         y = 4;
  59.                         matrix[x, y] = 1;
  60.                         continue;
  61.                     }
  62.                     if (y == 4)
  63.                     {
  64.                         y = 5;
  65.                         matrix[x, y] = 1;
  66.                         continue;
  67.                     }
  68.                     if (y == 3)
  69.                     {
  70.                         y = 6;
  71.                         matrix[x, y] = 1;
  72.                         continue;
  73.                     }
  74.                     if (y == 2)
  75.                     {
  76.                         y = 7;
  77.                         matrix[x, y] = 1;
  78.                         continue;
  79.                     }
  80.                     if (y == 1)
  81.                     {
  82.                         y = 8;
  83.                         matrix[x, y] = 1;
  84.                         continue;
  85.                     }
  86.                     if (y == 0)
  87.                     {
  88.                         y = 9;
  89.                         matrix[x, y] = 1;
  90.                         continue;
  91.                     }
  92.                    
  93.                 }
  94.             }
  95.             for (int i = 0; i < matrix.GetLength(0); i++)
  96.                 {
  97.                     for (int j = 0; j < matrix.GetLength(1); j++)
  98.                     {
  99.                         Console.Write(matrix[i,j]);
  100.                     }
  101.                     Console.WriteLine();
  102.                 }
  103.            
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment