-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
40 lines (31 loc) · 903 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// System dependencies
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "src/gamelogic.h"
int main(int argc, char *argv[])
{
const char* fileName = "../assets/transmission.bin";
char* fileBuffer;
unsigned int fileSize = 0;
int result = readFile(fileName, &fileBuffer, &fileSize);
if (result < 0)
{
printf("Error reading file\n");
return 0;
}
char actionBuffer[50] = {0};
unsigned int actionCount = 0;
getActions(fileBuffer, &fileSize, actionBuffer, &actionCount);
for (int i = 0; i < actionCount; i++)
{
printf("%d ", actionBuffer[i]);
}
printf("\n");
free(fileBuffer);
const coords gridSize = {4, 4};
coords currentPos = {0, 4};
doGame(gridSize, ¤tPos, actionBuffer, actionCount);
printf("Final position ['%d', '%d']\n\n", currentPos.x, currentPos.y);
return 1;
}