- Viewing Profile: Posts: mayoscuro
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 6
- Profile Views 267
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
105
Neutral
User Tools
Contacts
mayoscuro hasn't added any contacts yet.
Latest Visitors
No latest visitors to show
Posts I've Made
In Topic: Map of console rpg
25 October 2012 - 03:13 AM
Is developed in windows console ¿Is that what your asking me?
In Topic: Map of console rpg
24 October 2012 - 03:55 PM
Thanks ^ ^
Now I have another question ...
How I can detect the arrow keys without using the library <conio.h>?
Is there any way to use std :: KeyChar without pressing the enter key?
Now I have another question ...
How I can detect the arrow keys without using the library <conio.h>?
Is there any way to use std :: KeyChar without pressing the enter key?
In Topic: tic tac toe c++
26 April 2012 - 08:26 AM
Thank you everyone, at the end I solve one part of my problem with thant functions:
But now I have other problem, I need who one variable save the value of the last move,
I need that because in my code if you have | x | Nothing | x | and you put one X in the midle yo don't
win. That is the only problem.
So I need that variable to make my program who don't delete the X (or O) if x=oldx
The real problem is that variables must be initialized and can not find how to save the previous move.
Have I explained well?
Anyone can help my with that problem?
Thank you, one more time.
void recorrer(juego &tablero,int y,int x,int anteriorx,int anteriory){
int num_x=0;
int num_o=0;
int copiay=y;
int copiax=x;
//FILAS:
for(y ;y<tablero.size();y--){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
num_x=0;
num_o=0;
y=copiay;
for(y ;y>=0 && y<tablero.size();++y){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
//COLUMNAS:
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for(x ;x<tablero.size() && x>=0;x--){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for(x ;x>=0 && x<tablero.size();++x){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
//DIAGONALES(Izquierda a derecha):
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for (x,y; x>=0 && y>=0 || x<tablero.size() && y<tablero.size();x--, y--){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for (x,y; x<tablero.size() && y<tablero.size();x++, y++){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
//DIAGONALES(Derecha a izquierda):
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for (x,y; x<tablero.size() && y>=0;x--, y++){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
num_x=0;
num_o=0;
x=copiax;
y=copiay;
for (x,y; x<tablero.size() && y>=0;x++, y--){
incrementarxo(tablero,x, y,num_x,num_o,anteriorx,anteriory);
}
}
int incrementarxo(juego &tablero,int &x, int &y,int &num_x, int &num_o,int anteriorx, int anteriory){
if (tablero[x][y]=='X'){
num_x++;
ganarx(num_x);
return num_x;
}else if (num_x < 3 && tablero[x][y] != 'X' && x != anteriorx || num_x < 3 && tablero[x][y] != 'X' && y != anteriory) num_x=0;
if (tablero[x][y]=='O'){
num_o++;
ganaro(num_o);
return num_o;
}else if (tablero[x][y]=!'O' && num_o<3) num_o=0;
ganarx(num_x);
ganaro(num_o);
}
void ganaro(int num_o){
if(num_o>=3){
std::cout<<"Ha ganado el jugador 2"<<std::endl;
FinPartida();
}
}
void ganarx(int num_x){
if (num_x>=3){
std::cout<<"Ha ganado el jugador 1"<<std::endl;
FinPartida();
}
}
//FIN COMPROBACIONESBut now I have other problem, I need who one variable save the value of the last move,
I need that because in my code if you have | x | Nothing | x | and you put one X in the midle yo don't
win. That is the only problem.
So I need that variable to make my program who don't delete the X (or O) if x=oldx
The real problem is that variables must be initialized and can not find how to save the previous move.
Have I explained well?
Anyone can help my with that problem?
Thank you, one more time.
In Topic: tic tac toe c++
18 April 2012 - 03:07 PM
Yes,your right is variable size.
Sorry I will try to explain this to you , the rules are the same as in a original tic tac toe (3x3)
with the only exeption that you can chose the size(3x3,4x4...8x8).
Sorry I will try to explain this to you , the rules are the same as in a original tic tac toe (3x3)
with the only exeption that you can chose the size(3x3,4x4...8x8).
- Home
- » Viewing Profile: Posts: mayoscuro

Find content