Initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "MineField.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
MineField field(160,160, 100);
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
int x = rand() % 160;
|
||||
int y = rand() % 160;
|
||||
|
||||
field.initBombs(x, y);
|
||||
|
||||
printf("Opened cell: %i %i\n", x, y);
|
||||
printf("Neighboor bombs: %i\n", field.bombsNearby(x,y));
|
||||
|
||||
while(!field.isGameOver()) {
|
||||
x = rand() % 160;
|
||||
y = rand() % 160;
|
||||
|
||||
if(field.clearCell(x, y)) {
|
||||
printf("Opened cell: %i %i\n", x, y);
|
||||
printf("Neighboor bombs: %i\n", field.bombsNearby(x,y));
|
||||
}
|
||||
else {
|
||||
printf("Bomb found in cell: %i %i\n", x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user