示例#1
0
void startRipple() {
    int Count = 1;
    int i, j;
    Counter = 0;
    mup = 1, mdown = 1, mleft = 1, mright = 1;
    for(i = 0; i < 23; i++) {
      for(j = 0; j < 80; j++) {
	if(Board[i][j] > '0' && Board[i][j] <= '9') {
	  Row = i;
	  Col = j;
	  Counter = Board[i][j] - '0';
	}
      }
    }

    if(Counter == 0)
      return;
    Setup();
    PutInTerminal();
    ClearBoard();
    while(--Counter) {
      Zero(Count);
      Ninety(Count);
      OneEighty(Count);
      TwoSeventy(Count);
      FortyFive(Count);
      OneThirtyFive(Count);
      TwoTwentyFive(Count);
      ThreeFifteen(Count);
      Count++;
      PutInTerminal();
      ClearBoard();
    }     
}                                    
示例#2
0
int main() {
  char buf[100];
  // After that we use moggy to analyze it. (With default parameters).
  void* policy = playout_moggy_init(NULL);

  // Put a few random moves and ask mogo to play it out.
  AllMoves all_moves;
  GroupId4 ids;
  const int num_round = 10000;

  Board b;
  timeit
  for (int j = 0; j < num_round; j++) {
    printf("Round = %d/%d\n", j, num_round);
    ClearBoard(&b);
    //for (int i = 0; i < rand() % 100 + 1; ++i) {
    for (int i = 0; i < 0; ++i) {
      FindAllCandidateMoves(&b, b._next_player, 0, &all_moves);
      // Randomly find one move.
      int idx = rand() % all_moves.num_moves;
      if (TryPlay2(&b, all_moves.moves[idx], &ids)) {
        Play(&b, &ids);
      }
    }

    ShowBoard(&b, SHOW_LAST_MOVE);
    play_random_game(policy, NULL, NULL, &b, -1, FALSE);
    ShowBoard(&b, SHOW_LAST_MOVE);
  }
  endtime

  playout_moggy_destroy(policy);
  return 0;
}
示例#3
0
文件: Svrboard.cpp 项目: bulue/----
void CLogicBoad::Start()
{
	if (isPaused)
		return;

	isStarted = true;
	isFallingFinished = false;
	numLinesRemoved = 0;
	ClearBoard();

	stTetrisDrawText cmd;
	if (m_user && m_user->m_GameRoom) {
		CGameRoom* pRoom = m_user->m_GameRoom;
		for (int i =0 ;i  < 2; ++i) {
			CPlayer* pUser = pRoom->m_vPlayer[i];
			if (pUser) {
				if (pUser != m_user) {
					cmd.isMe = false;
					sprintf(cmd.szDrawText,"%s得分%d:",m_user->szAccount,numLinesRemoved);
				}else {
					cmd.isMe = true;
					sprintf(cmd.szDrawText,"您的得分:%d",numLinesRemoved);
				}
				pUser->SendToMe((stBaseCmd*)&cmd,sizeof(cmd));
			}
		}
	}

	NewPiece();
}
void _PositionStruct::Startup(unsigned char board[10][9]) {
  int sq;
  ClearBoard();
  if ( board != NULL )
  {
      for (int i = 0; i<10;i++)
	      for (int j = 0; j <9; j++){
		      if (board[i][j] > 0){
			      sq = (3+i)*16 + 3 + j;
			      AddPiece(sq, board[i][j]);
		      }
	      }
  }
  else
  {
      int pc;
      for (sq = 0; sq < 256; sq ++) {
        pc = cucpcStartup[sq];
        if (pc != 0) {
          AddPiece(sq, pc);
        }
      }
  }
  SetIrrev();
}
/*
=============================
idGameBustOutWindow::UpdateGame
=============================
*/
void idGameBustOutWindow::UpdateGame() {
	int i;

	if ( onNewGame ) {
		ResetGameState();

		// Create Board
		SetCurrentBoard();

		gamerunning = true;
	}
	if ( onContinue ) {
		gameOver = false;
		ballsRemaining = 3;

		onContinue = false;
	}
	if ( onNewLevel ) {
		currentLevel++;

		ClearBoard();
		SetCurrentBoard();

		ballSpeed = BALL_SPEED * ( 1.f + ((float)currentLevel/5.f) );
		if ( ballSpeed > BALL_MAXSPEED ) {
			ballSpeed = BALL_MAXSPEED;
		}
		updateScore = true;
		onNewLevel = false;
	}

	if(gamerunning == true) {

		UpdatePaddle();
		UpdateBall();
		UpdatePowerups();

		for( i = 0; i < entities.Num(); i++ ) {
			entities[i]->Update( timeSlice, gui->GetTime() );
		}

		// Delete entities that need to be deleted
		for( i = entities.Num()-1; i >= 0; i-- ) {
			if( entities[i]->removed ) {
				BOEntity* ent = entities[i];
				delete ent;
				entities.RemoveIndex(i);
			}
		}

		if ( updateScore ) {
			UpdateScore();
			updateScore = false;
		}
	}
}
示例#6
0
void SnakeGame::ResetBoardState() {
	ClearBoard();
	snakeBody[0].clear();
	snakeBody[1].clear();
	playerMov[0] = 1;
	playerMov[1] = -1;
	snakeBody[0].push_back(BOARD_WIDTH*BOARD_HEIGHT / 2);
	snakeBody[1].push_back(BOARD_HEIGHT*BOARD_WIDTH / 2 + BOARD_WIDTH - 1);
	RandomSpawnFood();
}
示例#7
0
//Resets the board state but not the score
void ResetBoard(std::string &b, std::vector<int> &p1, std::vector<int> &p2, int &fPos, int &p1Mov, int &p2Mov) {
	ClearBoard(b);
	p1.clear();
	p2.clear();
	p1Mov = 1;
	p2Mov = -1;
	p1.push_back(BOARD_WIDTH*BOARD_HEIGHT / 2);
	p2.push_back(BOARD_HEIGHT*BOARD_WIDTH/2 + BOARD_WIDTH-1);
	RandomSpawn(fPos, b);
}
示例#8
0
//Method to Initiate the Game
void TicTacToe::initiateGame()
{
	ClearBoard();
	gameRules();
	
	cout << endl;
	cout << endl;
	
	displayBoard();
	numGamesPlayed++;
}
示例#9
0
void CLogicBoad::Start()
{
    if (isPaused)
        return;

    isStarted = true;
    isFallingFinished = false;
    numLinesRemoved = 0;
    ClearBoard();

    NewPiece();
}
// the initilization function call
void Initilize()
{
	mxhwnd.LoadGraphic(&Background,"bg.bmp"); // load the background image into the MasterGraphic object
	mxhwnd.LoadGraphic(&XGraphic,"x.bmp"); // load the x image into the MasterGraphic object 
	mxhwnd.LoadGraphic(&OGraphic,"o.bmp"); // load the o image into the MasterGraphic object
	mxhwnd.LoadGraphic(&MasterXLogo,"mx.bmp"); // load the MasterX image into the MasterGraphic object
	mxhwnd.LoadSound(&Drop,MAKEINTRESOURCE(IDR_WAVE1));
	mxhwnd.LoadSound(&GameOverSound,MAKEINTRESOURCE(IDR_WAVE2));
	mxhwnd.LoadSound(&CatsGameSound,MAKEINTRESOURCE(IDR_WAVE3));
	ClearBoard();
	mxhwnd.SetScreen(ID_GAME);
	InitPlayers();
}
示例#11
0
void Board::Start()
{
    if (isPaused)
        return;

    isStarted = true;
    isFallingFinished = false;
    numLinesRemoved = 0;
    ClearBoard();

    NewPiece();
    timer->Start(500);
}
// ----------------------------------------------------
// CNoughtsAndCrossesEngine::CNoughtsAndCrossesEngine (TPlayer aHumanPlayer)
// Default constructor
// ----------------------------------------------------
//
CNoughtsAndCrossesEngine::CNoughtsAndCrossesEngine (TPlayer aHumanPlayer) :
	CTimer (CActive::EPriorityStandard), iObserver (NULL),
	iHumanPlayer (aHumanPlayer), iPlayerToGo (aHumanPlayer)
	{
	ClearBoard();
	CActiveScheduler::Add (this);
	
	// Determine computer player
	if(iHumanPlayer == ENought)
		iComputerPlayer = ECross;
	else
		iComputerPlayer = ENought;
	}
示例#13
0
Board::Board (wxFrame *parent)
    : wxPanel (parent, wxID_ANY, wxDefaultPosition,
               wxDefaultSize, wxBORDER_NONE)
{
    timer = new wxTimer (this, 1);
    m_stsbar = parent->GetStatusBar();
    isFallingFinished = false;
    isStarted = false;
    isPaused = false;
    numLinesRemoved = 0;
    curX = 0;
    curY = 0;
    ClearBoard();
    Connect (wxEVT_PAINT, wxPaintEventHandler (Board::OnPaint));
    Connect (wxEVT_KEY_DOWN, wxKeyEventHandler (Board::OnKeyDown));
    Connect (wxEVT_TIMER, wxCommandEventHandler (Board::OnTimer));
}
示例#14
0
文件: game.c 项目: zhu-jz/turtle
void ClearGame(GAME *Game, const BOARD *StartBoard) {

   if (StartBoard == NULL) {
      ClearBoard(Game->StartBoard);
   } else {
      CopyBoard(StartBoard,Game->StartBoard);
   }

   CopyBoard(Game->StartBoard,Game->Board);

   Game->MoveNo       = 0;
   Game->Move[0].Move = NO_MOVE;

   ElapsedTime[0] = 0.0;
   ElapsedTime[1] = 0.0;

   TurnBegin = CurrentTime();
}
// ----------------------------------------------------
// CNoughtsAndCrossesEngine::StartNewGame(TPlayer aHumanPlayer)
// New game
// ----------------------------------------------------
//
void CNoughtsAndCrossesEngine::StartNewGame(TPlayer aHumanPlayer)
	{
	SetFirstMove(ETrue);
	this->iHumanPlayer = aHumanPlayer;
	iPlayerToGo = aHumanPlayer;

	// Determine computer
	if(iHumanPlayer == ENought)
		iComputerPlayer = ECross;
	else
		iComputerPlayer = ENought;

	ClearBoard();
	if (iObserver)
		{
		iObserver->HandleBoardReset();
		}
	}
示例#16
0
void file_cb(Widget widget, XtPointer client, XtPointer call)
{
    int selection = (int) client;

    switch(selection) {
        case 0:    /* New Game */
            NewGame();
            break;
        case 1: /* Stop Game */
            StopGame();
            Message("Game stopped");
            break;
        case 2:    /* Quit */
            ClearBoard();
            StopGame();
            exit(0);
    }
}
/*
=============================
idGameBustOutWindow::ResetGameState
=============================
*/
void idGameBustOutWindow::ResetGameState() {
	gamerunning = false;
	gameOver = false;
	onFire = false;
	onContinue = false;
	onNewGame = false;
	onNewLevel = false;

	// Game moves forward 16 milliseconds every frame
	timeSlice = 0.016f;
	ballsRemaining = 3;
	ballSpeed = BALL_SPEED;
	ballsInPlay = 0;
	updateScore = false;
	numBricks = 0;
	currentLevel = 1;
	gameScore = 0;
	bigPaddleTime = 0;
	nextBallScore = gameScore + 10000;

	ClearBoard();
}
示例#18
0
void SnakeGame::UpdateBoardState()
{
	bool gameover = false;

	int p1Next = snakeBody[0].front() + playerMov[0];
	snakeBody[0].insert(snakeBody[0].begin(), p1Next);

	int p2Next = snakeBody[1].front() + playerMov[1];
	snakeBody[1].insert(snakeBody[1].begin(), p2Next);

	if (CheckHitBoundary(snakeBody[0].front(), playerMov[0])) {
		playerScore[1]++;
		gameover = true;
	}
	if (CheckHitBoundary(snakeBody[1].front(), playerMov[1])) {
		playerScore[0]++;
		gameover = true;
	}

	if (!gameover) {
		if (fruitPos != snakeBody[0].front())
			snakeBody[0].pop_back();
		else {
			RandomSpawnFood();
			playerScore[0]++;
		}

		if (fruitPos != snakeBody[1].front())
			snakeBody[1].pop_back();
		else {
			RandomSpawnFood();
			playerScore[1]++;
		}
	}

	ClearBoard();
	if (gameover || !UpdateBoard())
		ResetBoardState();
}
示例#19
0
void ResetBoard(void)
{
    int x,y,pos;

    ClearBoard();
    pos = 1;
    for(y=0; y<8; y++)
    for(x=0; x<8; x++)
    {
        if(x%2 != y%2) {
            square[y][x].val = pos;
            if(y<3 || y>4) square[y][x].state = Piece; else square[y][x].state = Empty;
            if(y<3) square[y][x].col = Red; else
            if(y>4) square[y][x].col = White; else
            square[y][x].col = Black;
            square[y][x].hilite = Green;
#ifdef GRAPHICS
            UpdateSquare(x,y);
#endif
            pos++;
        } 
    }
}
示例#20
0
文件: game.cpp 项目: kdudzik/MiMHex
Game::Game() : empty_board(Board::Empty()), last_move(0) {
	ClearBoard();
}
// the window callback function 
// which we passed a pointer to on the CreateMasterX method, this callback function contains a variable called
// msg that we switch and have different case 's for different messages windows sends are program
// like the WM_DESTROY message, this is were we post the quit message to break the while loop
// that we initilized in the InitLoop method.
LRESULT APIENTRY WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
	case WM_DESTROY:// called when the window is destroyed
		PostQuitMessage(0);// breaks the while loop
		break;
	case WM_ACTIVATEAPP:
		mxhwnd.activeapp = wParam;// sets the app as active
		break;
	case WM_KEYDOWN:// is sent when a key is pressed
		{
			switch(wParam) // contains the key that was pressed
			{
			case VK_ESCAPE:// when the escape key is pressed
				{
					mxhwnd.Kill();// break the while loop
				}
				break;
			}

			switch(mxhwnd.GetScreen())
			{
			case ID_GAME:
				{
					switch(wParam)
					{
					case VK_RETURN:
						{
							mxhwnd.SetScreen(ID_ABOUT);
						}
						break;
					case VK_SPACE:
						{
							if(GameOver == true)// if the Game is Over then when they press space
							{                   // we wanna Clear the Board, Initilize the Players
								ClearBoard();   // and set GameOver to false
								InitPlayers();
								GameOver = false;
							}
						}
						break;
					}

				}
				break;
			case ID_ABOUT:
				{
					switch(wParam)
					{
					case VK_SPACE:
					case VK_RETURN:
						{
							mxhwnd.SetScreen(ID_GAME);
						}
						break;
					}
				}
				break;
			}

		}
		break;
	case WM_LBUTTONDOWN:// the WM_LBUTTONDOWN, when the left mouse button is clicked
		{
			int x = LOWORD(lParam), y = HIWORD(lParam);

			if(GameOver == false)
			{


			// a if statement to check and see if they clicked within a rectangle
			// if they did then set the Board[0][0] to the Player thats turn it is
			if(x > 50 && x < 160 && y > 130 && y < 200)
			{
				// switch of the Player thats turn it is
				switch(Player)
				{
				case 1:
					{
						if(Board[0][0] == EMPTY)
						{
						Board[0][0] = Player1; // set Board[0][0] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[0][0] == EMPTY)
						{
						Board[0][0] = Player2;// set Board[0][0] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}
			}

			// a if statement to check and see if they clicked within a rectangle
			// if they did then set Board[0][1] to Player thats turn it is
			if(x > 175 && x < 440 && y > 100 && y < 200)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[0][1] == EMPTY)
						{
						Board[0][1] = Player1;// set Board[0][1] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[0][1] == EMPTY)
						{
						Board[0][1] = Player2;// set Board[0][1] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}


			// a if statement to see if they clicked within a specific rectangle
			// this rectangle is the upper left hand corner of the screen
			// and is were Board[0][2] is drawn 
			if(x > 460 && x < 580 && y > 100 && y < 200)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[0][2] == EMPTY)
						{
						Board[0][2] = Player1;// set Board[0][2] to Player1's value
						NextMove(); // do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[0][2] == EMPTY)
						{
						Board[0][2] = Player2;// set Board[0][2] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}
			}

			// a if statement to see if they clicked within a rectangle
			// its checking to see if they clicked in the the right middle 
			if(x > 50 && x < 160 && y > 215 && y < 335)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[1][0] == EMPTY)
						{
						Board[1][0] = Player1;// set Board[1][0] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[1][0] == EMPTY)
						{
						Board[1][0] = Player2;// set Board[1][0] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}

			// a if statement to see if they clicked within a rectangle
			// the rectangle is the center of the screen the center sqaure
			if(x > 175 && x < 445 && y > 220 && y < 335)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[1][1] == EMPTY)
						{
						Board[1][1] = Player1;// set Board[1][1] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[1][1] == EMPTY)
						{
						Board[1][1] = Player2;// set Board[1][1] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}

			// a if statement to see if they clicked within a rectangle
			// the rectangle is near the middle right of the screen
			if(x > 450 && x < 585 && y > 220 && y < 335)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[1][2] == EMPTY)
						{
						Board[1][2] = Player1;// set Board[1][2] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[1][2] == EMPTY)
						{
						Board[1][2] = Player2;// set Board[1][2] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}


			}

			// a if statment to see if they clicked within a rectangle
			// the rectangle is near the lower left hand corner of the screen
			if(x > 50 && x < 160 && y > 350 && y < 445)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[2][0] == EMPTY)
						{
						Board[2][0] = Player1;// set Board[2][0] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[2][0] == EMPTY)
						{
						Board[2][0] = Player2;// set Board[2][0] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}

			// a if statement to see if they clicked within a rectangle
			// the rectangle is near the bottom middle of the screen
			if(x > 175 && x < 445 && y > 350 && y < 430)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[2][1] == EMPTY)
						{
						Board[2][1] = Player1;//set Board[2][1] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[2][1] == EMPTY)
						{
						Board[2][1] = Player2;// set Board[2][1] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}

			// a if statement to see if they clicked within a rectangle
			// this is to see if they clicked the square in the bottom right hand corner
			if(x > 450 && x < 585 && y > 350 && y < 445)
			{
				switch(Player)
				{
				case 1:
					{
						if(Board[2][2] == EMPTY)
						{
						Board[2][2] = Player1;// set Board[2][2] to Player1's value
						NextMove();// do the NextMove
						}
					}
					break;
				case 2:
					{
						if(Board[2][2] == EMPTY)
						{
						Board[2][2] = Player2;// set Board[2][2] to Player2's value
						NextMove();// do the NextMove
						}
					}
					break;
				}

			}

			}

		}
		break;
	default:
		return DefWindowProc(hwnd,msg,wParam,lParam);// call the default window proccess
	}
	return (0);
}
示例#22
0
int main(int argc, char **argv) {

	std::string board = std::string(BOARD_WIDTH*BOARD_HEIGHT, '=');

	int p1Move = 1;
	int p2Move = -1;
	int p1Score = 0;
	int p2Score = 0;
	int fruitPos = 0;

	std::vector<int> player1;
	std::vector<int> player2;

	ResetBoard(board, player1, player2, fruitPos, p1Move, p2Move);


	bool quit = false;

	while (!quit) {
		//REMOVE FOR FINAL CODE
		system("cls");

		//REMOVE FOR FINAL CODE
		//Change to receive client comamnds
		if (_kbhit())
		{
			switch (_getch())
			{
			//Player 1 Movement
			case 'a': 
				if(p1Move != 1)
					p1Move = -1;
				break;
			case 'd':
				if(p1Move != -1)
					p1Move = 1;
				break;
			case 'w': 
				if(p1Move != BOARD_WIDTH)
					p1Move = BOARD_WIDTH*-1;
				break;
			case 's': 
				if(p1Move != BOARD_WIDTH*-1)
					p1Move = BOARD_WIDTH*1;
				break;

			//Player 2 Movement
			case 75:
				if(p2Move != 1)
					p2Move = -1;
				break;
			case 77:
				if(p2Move != -1)
					p2Move = 1;
				break;
			case 72:
				if(p2Move != BOARD_WIDTH)
					p2Move = BOARD_WIDTH*-1;
				break;
			case 80: 
				if(p2Move != BOARD_WIDTH*-1)
				p2Move = BOARD_WIDTH * 1;
				break;

			}
		}

		bool gameover = false;

		int p1Next = player1.front() + p1Move;
		player1.insert(player1.begin(),p1Next);

		int p2Next = player2.front() + p2Move;
		player2.insert(player2.begin(), p2Next);

		if (HitBoundary(player1.front(), p1Move)) {
			p2Score++;
			gameover = true;
		}
		if (HitBoundary(player2.front(), p2Move)) {
			p1Score++;
			gameover = true;
		}

		if (!gameover) {
			if (fruitPos != player1.front())
				player1.pop_back();
			else {
				RandomSpawn(fruitPos, board);
				p1Score++;
			}

			if (fruitPos != player2.front())
				player2.pop_back();
			else {
				RandomSpawn(fruitPos, board);
				p2Score++;
			}
		}

		ClearBoard(board);
		if(gameover || !UpdateBoard(board, player1,player2,fruitPos,p1Score,p2Score,p1Move,p2Move))
			ResetBoard(board, player1, player2, fruitPos, p1Move, p2Move);


		//REMOVE FOR FINAL CODE
		DisplayState(board,p1Score,p2Score);
		Sleep(100);
	}


	
	return 0;
}
示例#23
0
文件: main.cpp 项目: 3A9C/ITstep
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {

    MSG msg;
    int dwRefresh;
    LARGE_INTEGER LargeInt;


    if (InitInstance(hInstance) == FALSE) {
        return FALSE;
    }

    //Init random seed
    QueryPerformanceCounter(&LargeInt);
    srand(LargeInt.LowPart);
    ////////////////////////////////////////

    InitializeCriticalSection(&crsCurPiece);

    ClearBoard();

    dwRefresh = GetTickCount();

    PushRandomPiece();
    DrawBoard();
    UpdateScreen();


    while (1) {

        if (PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE) {

            if (GetMessageA(&msg, NULL, 0, 0) == FALSE) {
                return 0;
            }

            TranslateMessage(&msg);
            DispatchMessage(&msg);

        }
        else {


            if (GetTickCount() >= (DWORD)(dwRefresh + FallingPieceSpeed)) {

                DrawBoard();
                UpdateScreen();

                dwRefresh = GetTickCount();

                EnterCriticalSection(&crsCurPiece);

                if (IsActionPossible(CurPiece.Piece, CurPiece.PosX, CurPiece.PosY + 1) == TRUE) {

                    CurPiece.PosY++;

                }
                else {

                    if (SaveCurPiece() == TRUE) {
                        MessageBoxA(NULL, "Game Over!", NULL, MB_OK);
                        ExitProcess(0);
                    }
                    DeleteLines();
                    PushRandomPiece();
                }

                LeaveCriticalSection(&crsCurPiece);

            }

            Sleep(100); //give that CPU some rest
        }
    }


    return 0;
}