int main(){ Position position; FILE *save = NULL; if(!save_pos(save, 'r',&position.x,&position.y)){ init_Position(&position); } printf("Press Q to close and save the program, or E to close without saving.\n Press W,S,A,D to move the position!\n"); if(game_loop(&position) == 'q'){ save_pos(save,'w',&position.x,&position.y); } return 0; }
struct Position* getPosition(char* _stack) { int hash = hashOfStack(_stack); struct Queue* q = &positions[hash]; struct Position* pos = findInQueuePos(q, _stack); if(pos == NULL){ pos = (struct Position*)malloc_zero(sizeof(struct Position)); init_Position(pos, _stack); addToQueue(q, pos); } //LOGD("pos = %s", pos->id); return pos; }