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.Drawing;
- using System.Windows.Forms;
- namespace Hledani_min
- {
- class Array
- {
- public int x = 20;
- public int y = 20;
- public int[,] pole;
- public int miny = 20;
- public bool obsazeno;
- //barvy
- public Array()
- {
- pole = new int[x, y];
- }
- public void Obsazovani()
- {
- //obsadi pole honotou
- //1 = mina
- //0 = skryte prazdne policko
- //2 = skryta mina
- //3 = prazdne policko
- Random random = new Random();
- for (int d = 0; d < miny; )
- {
- int rndx = random.Next(x);
- int rndy = random.Next(y);
- if (pole[rndx, rndy] == 0)
- {
- pole[rndx, rndy] = 1;
- d++;
- }
- obsazeno = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement