Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <windows.h>//gotoxy
- #define dim 7
- #define NULA 0
- #define VACIA 2
- #define FICHA 10
- using namespace std;
- ///////////////////////////////////////////////////////////
- COORD coordenadas={0,0};
- int tablero[dim][dim];
- /////////////////////////////////////////////////////////
- typedef struct{
- int tablero[dim][dim];
- int nFichas;//NUMERO DE FICHAS
- int nMovimientos;//NUMERO DE MOVMIENTOS REALIZADOS EN EL JUEGO
- string tipoEstado;//ESTADO QUE SE ENCUENTA EN EL JUEGO
- int tcelda[dim][dim];//ESTADO DE CADA CELDA
- }tJUEGO;
- ////////////////// DECLARACION DE FUNCIONES ////////////////////////
- void mostrar(int x, int y){
- coordenadas.X = x;
- coordenadas.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coordenadas);
- }
- void tableroInicial(int [dim][dim]);
- void mFOR(int,int);
- //////////////////////////////////////////
- int main(){
- tableroInicial(tablero);
- mostrar(dim,dim);
- return 0;
- }
- //////////////////////////////////////////
- void tableroInicial(int tablero[dim][dim]){
- for (int fila = 0; fila < 7; fila++) {
- for (int columna = 0;columna < 7; columna++){
- if (fila == 3 && columna == 3){
- tablero[fila][columna] = VACIA;
- }else{
- if( (fila < 2 || fila > 4)&&(columna < 2 || columna > 4) ){
- tablero[fila][columna] = NULA;
- }else{
- tablero[fila][columna] = FICHA;
- }
- }
- }
- }
- }
- /////////////////////////////////////////////////////////////////////7
- void mFOR(int dim, int dim){
- for (int fila = 0; fila < dim; fila++) {
- for (int columna = 0; columna < dim; columna++){
- mostrar(10+columna*5,5+fila);
- cout<<tablero[fila][columna];
- }
- cout<<" "<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement