Esempio n. 1
0
void myMain()
{
	inputDue();
	inputPaid();
	calcDifference(amountDue, amountPaid);
	calcChange(difference);
}
Esempio n. 2
0
int main(int argc, char* argv[])
{
	int width, height;
	int** board;
	FILE* file;
	struct Queue* changeQueue;

	if (argc!=2)
	{
		printf("the right usage is: life <board file>\n");
		return WRONG_ARGUMENTS;
	}
	/*open board file*/
	file = fopen(argv[1], "r");
	if (file==NULL)
	{
		printf("error in openning the board file\n");
		return FILE_OPEN_ERROR;
	}

	board = readBoard(file, &width, &height);

	/*close board file*/
	if (fclose(file) != 0)
	{
		free(board);
		return FILE_CLOSE_ERROR;
		printf("error in closing the board file\n");
	}
	if (board==NULL)
	{
		return FILE_FORMAT_ERROR;
	}

	changeQueue = newQueue();

	/*print initial state*/
	system("cls");/*clear the screen*/
	printBoard(board, width, height);
	Sleep(2000);

	/*game math*/
	while (1)
	{
		calcChange(board, width, height, changeQueue);
		flip(board,changeQueue);
		system("cls");/*clear the screen*/
		printBoard(board, width, height);
		Sleep(1500);
	}

	/*doesn't really get here because it's an infinte loop*/
	deleteQueue(changeQueue);
	freeBoard(board,height);
	return 0;
}
Esempio n. 3
0
void handleMove(float x, float y)
{
    g_playerPosChangeTarget = calcChange(x, g_width, g_touchStartX, g_playerPosChangeTarget, kPosChangeScale, kPosChangeMax);
    g_playerAngleChangeTarget = calcChange(-y, g_height, -g_touchStartY, g_playerAngleChangeTarget, kAngleChangeScale, kAngleChangeMax);
}
Esempio n. 4
0
void changeArrayTest()
{
  ASSERT_EQUAL("1;2;1,2;2,2;5;",calcChange(5));
  ASSERT_EQUAL("1;2;1,2;2,2;5;1,5;2,5;1,2,5;2,2,5;5,5;1,5,5;2,5,5;1,2,5,5;2,2,5,5;5,5,5;1,5,5,5;",calcChange(16));
}