Ejemplo n.º 1
0
void		testOneSpare()
{
  setup();
  rollSpare();
  gameRoll(3);
  rollMany(17, 0);
  assert(gameScore() == 16);
}
Ejemplo n.º 2
0
void		testOneStrike()
{
  setup();
  gameRoll(10);
  gameRoll(3);
  gameRoll(4);
  rollMany(16, 0);
  assert(gameScore() == 24);
}
Ejemplo n.º 3
0
void moveDot(char screen[HEIGHT][WIDTH], Direction dotDirection, Dot * d, Racket ** list) {
	if (screen[d->height][d->width] == RACKET_BRUSH)
	{
		screen[d->height][d->width] = RACKET_BRUSH;
		return;
	}
	screen[d->height][d->width] = SPACE;
	bool hitWall = false;
	switch (dotDirection)
	{
	case UP:
		d->height -= d->deltaHeight;
		break;
	case DOWN:
		d->height += d->deltaHeight;
		break;
	case RIGHT:
		d->width += d->deltaWidth;
		break;
	case LEFT:
		d->width -= d->deltaWidth;
		break;
	case UPLEFT:
		moveDot(screen, UP, d, list);
		moveDot(screen, LEFT, d, list);
		break;
	case UPRIGHT:
		moveDot(screen, UP, d, list);
		moveDot(screen, RIGHT, d, list);
		break;
	case DOWNLEFT:
		moveDot(screen, DOWN, d, list);
		moveDot(screen, LEFT, d, list);
		break;
	case DOWNRIGHT:
		moveDot(screen, DOWN, d, list);
		moveDot(screen, RIGHT, d, list);
		break;
	}

	/* Bounding Box */

	if (d->height <= 0)
	{
		d->height = 1;
		hitWall = true;
	}
	if (d->height >= HEIGHT - 1)
	{
		d->height = HEIGHT - 2;
		hitWall = true;
	}
	if(d->width < 0)
	{
		gameScore(list[1]);
		printScore(list[0]->score, list[1]->score);
		initializeDot(screen, d, UPLEFT);

	}else if (d->width >= WIDTH)
	{
		gameScore(list[0]);
		printScore(list[0]->score, list[1]->score);
		initializeDot(screen, d, UPRIGHT);
	}

	if (hitWall)
	{
		dotHitWall(screen, d);
	}
	screen[d->height][d->width] = DOT;
}
Ejemplo n.º 4
0
void		testAllOnes()
{
  setup();
  rollMany(20, 1);
  assert(gameScore() == 20);
}
Ejemplo n.º 5
0
void		testGutterGame()
{
  setup();
  rollMany(20, 0);
  assert(gameScore() == 0);
}