示例#1
0
bool Board::SetColorByNumber(int color)
{
	if ((color==board[0][0]) || IsLose() || IsWin())
		return false;
	oldcolor = board[0][0];
	ChangeColor(0, 0, color);
	
	step_count++;
	// check for winnings
	win = CheckForWin();
	
	return true;
}
示例#2
0
文件: Game.cpp 项目: mpgaillard/Games
int GameUpdate(TGAME* Juego){
	Juego->GanadorEncontrado = CheckFull();

	Keyboard_Update(&(Juego->Teclado));

	if(Keyboard_Check(&(Juego->Teclado), eKey_Esc)){
		Juego->EstadoActual = Terminado;
		return 0;
	}

	if(Juego->GanadorEncontrado){
		Juego->EstadoActual = Lleno;
		if(Keyboard_Check(&(Juego->Teclado), eKey_Enter)){
			GameInit(Juego);
		}
		return 0;
	}

	if(!(Juego->pos_o_linea)){
		CheckForWin(Juego);
	}

	if(Keyboard_Check(&(Juego->Teclado), eKey_Enter) && Juego->pos_o_linea==false){
		Sleep(200);
		Juego->pos_o_linea = !(Juego->pos_o_linea);
		//GraphicManager_WriteChar(&(Juego->Pantalla), pos_cursor[0], pos_cursor[1], ' ');
		if(pos_cursor[0]<48)
			Juego->eLinea = Right;
		else Juego->eLinea = Left;
	}

	else if(Keyboard_Check(&(Juego->Teclado), eKey_Enter) && Juego->pos_o_linea==true){
		Juego->pos_o_linea = !(Juego->pos_o_linea);
	//	GraphicManager_WriteChar(&(Juego->Pantalla), pos_cursor[0], pos_cursor[1], ' ');
	}


	return 0;
}