Professional Documents
Culture Documents
*/
import java.util.*;
import java.lang.*;
import java.io.*;
/*
* File:
main.cpp
* Author: edward
*/
#include <cstdlib>
#include <iostream>
#include <time.h>
//#include "unistd.h"
#define COLUMNAS 9
#define FILAS 9
#define SIN_BOMBA -2
#define BOMBA -1
#define SIN_JUGAR -3
#define ESTADO_PERDEDOR 0
#define ESTADO_GANADOR 1
#define ESTADO_EN_JUEGO 2
int campo[FILAS][COLUMNAS];
bool jugadas[FILAS][COLUMNAS];
//Casilla jugada
int njugadas;
int estado;
/*
*/
void iniciaArr(){
int i,j;
x, int y){
= 0;
x-1; i < x+2; i++){
j = y-1; j < y+2; j++){
i >= 0 && i < FILAS && j >= 0 && j < COLUMNAS ){
if( campo[i][j] == BOMBA){ //Existe bomba
nbombas++;
}
}
}
}
return nbombas;
}
void establecerNumeros(){
int i,j, numero;
for( i = 0; i < FILAS; i++){
for(j = 0; j < COLUMNAS; j++){
if( campo[i][j] == SIN_BOMBA){ //no tiene bomba
numero = contar2(i,j);
campo[i][j] = numero;
}
}
}
}
void printAll(){
for(int i = 0; i < FILAS; i++){
for(int j = 0; j < COLUMNAS; j++){
if( campo[i][j] == BOMBA){
cout << " * ";
}else{
cout << " " << campo[i][j] << " ";
}
}
cout << endl;
}
}
void jugada(int x, int y){
if( x >= 0 && x < FILAS && y >= 0 && y < COLUMNAS ){
jugadas[x][y] = true;
if( campo[x][y] == BOMBA){
estado = ESTADO_PERDEDOR;
}
}else{
cout << "Imposible jugada" << endl;
system("pause");
}
}
int contarJugadas(){
int numero = 0;
for(int i = 0; i < FILAS; i++){
for(int j = 0; j < COLUMNAS; j++){
if ( jugadas[i][j]){
numero++;
}
}
}
return numero;
}
void jugadaEnGrupo(int x, int y){
if( x >= 0 && x < FILAS && y >= 0 && y < COLUMNAS ){
jugadas[x][y] = true;
if( campo[x][y] == BOMBA){
estado = ESTADO_PERDEDOR;
jugadaEnGrupo(i,j);
}else{
jugadas[i][j] = true;
}
}
int getMenu(){
int opt;
return opt;
}
void aboutMe(){
cout << "Version:" << version << " Build:" << build << endl;
}