
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include <locale.h>
#include <time.h>


#include <helper.h>
#include <tui.h>
#include <loop.h>
#include <game.h>
#include <algorithm.h>
#include <config.h>
#include <items.h>



#include <unistd.h>
int main()
{
	srand(time(NULL));

	setup();
	logstr("Game started");

	struct game g = make_maze(randrange(GAME_MIN_Y, GAME_MAX_Y), randrange(GAME_MIN_X, GAME_MAX_X));
	size_t num_enemies = randrange(MIN_ENEMIES, MAX_ENEMIES);
	for(size_t i = 0; i < num_enemies; i++)
	{
		spawn_enemy(&g);
	}

	size_t num_items = randrange(MIN_LOOT, MAX_LOOT);
	for(size_t i = 0; i < num_items; i++)
	{
		spawn_item(&g);
	}
	
	loop(&g);

	delete_game(&g);
}
