1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#include <iostream>
#include <conio.h>
#include <algorithm>
#include <ctime>
using namespace std;
//Beginner game void functions
void draw_gridBeginner(){
int x,y;
char grid[8][8]= {{255}};
char topl[33]={201,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,187};
char midl[33]={204,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,185};
char bottoml[33]={200,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,188};
cout<<endl;
cout<<topl<<endl;
for(x=0;x<8;x++)
{
for(y=0;y<8;y++)
{
if(y==0)
cout<<char(186);
cout<<char(32)<<grid[x][y];
if (grid[x][y] <8)
cout<<char(32)<<char(186);
else
cout<<char(186);
}
cout<<endl;
if (x<8)
cout<<midl<<endl;
}
}
void mineBeginner() // randomises 10 mines (9) into an array
{
int mField[8][8] = {{0,0,9,0,0,9,0,0},{0,0,9,0,0,9,0,0},{0,0,9,0,0,0,0,0},{0,0,9,0,0,0,0,0},{0,0,0,0,0,9,0,0,},{0,0,9,0,0,0,0,0},{0,0,9,0,0,0,0,0},{0,0,0,9,0,0,0,0}};
int x = 0;
srand ((unsigned int)(time(0)));
for(int x=0; x<8; x++){
for(int j=0;j<8; j++){
int values1=rand()%8;
int values2=rand()%8;
int temp =mField[x][j];
mField[x][j]=mField[values1][values2];
mField[values1][values2]=temp;
}
}
for(int x=0; x<8; x++)
{
for(int j=0;j<8;j++)
{
cout<<mField[x][j];
}
cout<<endl;
}
}
// End Beginner game void functions
int main(){
draw_gridBeginner();
return 0;
}
| |