Advertisement
Guest User

Untitled

a guest
Aug 21st, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 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 TRUERPG
  8. {
  9.     class Matrix
  10.     {
  11.         const int Rows = 5;
  12.         const int Cols = 5;
  13.         public string[,] Map = new string[Rows, Cols];
  14.         public void CreateMap(string[,] Map)
  15.         {
  16.             for (int ROW = 0; ROW < Rows; ROW++)
  17.             {
  18.                 for (int COL = 0; COL < Cols; COL++)
  19.                 {
  20.                     for (int rand = 0; rand < COL; rand++)
  21.                     {
  22.                         Random randome = new Random();
  23.                         if (randome.NextDouble() > 0.8)
  24.                         {
  25.                             Map[ROW, COL] = "#";
  26.                         }
  27.                         else
  28.                         {
  29.                             Map[ROW, COL] = ".";
  30.                         }
  31.                     }
  32.                     Console.Write(Map[ROW,COL]);
  33.                 }
  34.                 Console.WriteLine();
  35.             }
  36.         }
  37.     }
  38.     class Program
  39.     {
  40.  
  41.         static void Main(string[] args)
  42.         {
  43.             string[,] Map = new string[5, 5];
  44.             Matrix MapTest = new Matrix();
  45.             MapTest.CreateMap(Map);
  46.             Console.ReadKey();
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement