void DoBulletTest() { GameSettings settings; settings.Rules == RT_Sochi; settings.BulletSize = 5; Bullet bullet; bullet.Initialize(settings); DealResult gr; gr.Bids[0] = Bid_Pass; gr.Bids[1] = Bid_HalfWhist; gr.Bids[2] = Bid_6s; gr.Tricks[0] = 0; gr.Tricks[1] = 2; gr.Tricks[2] = 8; bullet.UpdateScores(gr); printBullet(bullet.GetScores()); gr.Bids[0] = Bid_Pass; gr.Bids[1] = Bid_Whist; gr.Bids[2] = Bid_6s; gr.Tricks[0] = 1; gr.Tricks[1] = 3; gr.Tricks[2] = 6; vector<float> evals = bullet.EvaluateDeal(gr); for( int i = 0; i < evals.size(); i++ ) { GetLog() << evals[i] << " "; } GetLog() << endl; bullet.UpdateScores(gr); printBullet(bullet.GetScores()); gr.Bids[0] = Bid_Whist; gr.Bids[1] = Bid_6s; gr.Bids[2] = Bid_Whist; gr.Tricks[0] = 1; gr.Tricks[1] = 6; gr.Tricks[2] = 3; bullet.UpdateScores(gr); printBullet(bullet.GetScores()); gr.Bids[0] = Bid_Pass; gr.Bids[1] = Bid_Pass; gr.Bids[2] = Bid_Misere; gr.Tricks[0] = 5; gr.Tricks[1] = 5; gr.Tricks[2] = 0; bullet.UpdateScores(gr); printBullet(bullet.GetScores()); GetLog() << (bullet.IsFinished() ? "finished" : "not finished") << endl; gr.Bids[0] = Bid_Whist; gr.Bids[1] = Bid_Whist; gr.Bids[2] = Bid_6s; gr.Tricks[0] = 1; gr.Tricks[1] = 2; gr.Tricks[2] = 7; bullet.UpdateScores(gr); printBullet(bullet.GetScores()); GetLog() << (bullet.IsFinished() ? "finished" : "not finished") << endl; }
bool bulletWay(Tank *tank) { COORD bulletPosition = tank->position; TankDirection shootDir = tank->direction; int i = 0; switch(shootDir) { case NORTH: bulletPosition.Y +=5; case SOUTH: bulletPosition.X +=2; break; case EAST: bulletPosition.X +=8; case WEST: bulletPosition.Y +=1; break; } while (1) { Sleep(20); i++; switch (shootDir) { case SOUTH: { int one = 165 * (bulletPosition.Y - 1) + bulletPosition.X; if (i > 1) { SetConsoleCursorPosition(hCon,bulletPosition); printf(" "); } bulletPosition.Y = (bulletPosition.Y - 1); if(!printBullet(bulletPosition, one)) return false; continue; } case NORTH: { int one = 165 * (bulletPosition.Y + 1) + bulletPosition.X; if (i > 1) { SetConsoleCursorPosition(hCon,bulletPosition); printf(" "); } bulletPosition.Y = (bulletPosition.Y + 1); if(!printBullet(bulletPosition, one)) return false; continue; } case EAST: { int one = 165 * (bulletPosition.Y) + (bulletPosition.X + 1); if (i > 1) { SetConsoleCursorPosition(hCon,bulletPosition); printf(" "); } bulletPosition.X = (bulletPosition.X + 1); if(!printBullet(bulletPosition, one)) return false; continue; } case WEST: { int one = 165 * (bulletPosition.Y) + (bulletPosition.X - 1); if (i > 1) { SetConsoleCursorPosition(hCon,bulletPosition); printf(" "); } bulletPosition.X = (bulletPosition.X - 1); if(!printBullet(bulletPosition, one)) return false; continue; } } } }