<commit_before>#include "stdafx.h"
#include "../stdafx.h"
#include "GameScreen.h"

const int POINT_SIZE = 10; // 10 Pixels high and wide for every segment
const int BORDER_WIDTH = 3; // 2 Points of border
const int SNAKE_START_SIZE = 3;  // 3 Points start size
const float SNAKE_UPDATE_FREQUENCY = 1.0f; // Once every second

GameScreen::GameScreen(String _name, InputManager* _input, SDL_Window* _window) : BaseScreen(_name, _input, _window)
{
}


GameScreen::~GameScreen()
{
}


void GameScreen::PlaceFood()
{
	// TODO: Find a better/faster way of randomly placing food
	bool isPlaced = false;

	while (!isPlaced)
	{
		int randomX = rand() % LevelWidth;
		int randomY = rand() % LevelHeight;

		if (LevelGrid[std::make_pair(randomX, randomY)] == LEVEL_SEGMENT_BLANK)
		{
			LevelGrid[std::make_pair(randomX, randomY)] = LEVEL_SEGMENT_PLAYER_FOOD;
			LevelFoodLocation = std::make_pair(randomX, randomY);
			isPlaced = true;
		}
	}
}


void GameScreen::CollectFood()
{
	// TODO: Add points
	EntSnake->isFoodCollected = false;
	//PlaceFood();
}


void GameScreen::Load()
{
	BaseScreen::Load();

	srand(time(NULL)); // Initialize random seed<commit_msg>Add placing food<commit_after>#include "stdafx.h"
#include "../stdafx.h"
#include "GameScreen.h"

const int POINT_SIZE = 10; // 10 Pixels high and wide for every segment
const int BORDER_WIDTH = 3; // 2 Points of border
const int SNAKE_START_SIZE = 3;  // 3 Points start size
const float SNAKE_UPDATE_FREQUENCY = 0.8f; // .8 of Every second

GameScreen::GameScreen(String _name, InputManager* _input, SDL_Window* _window) : BaseScreen(_name, _input, _window)
{
}


GameScreen::~GameScreen()
{
}


void GameScreen::PlaceFood()
{
	// TODO: Find a better/faster way of randomly placing food
	bool isPlaced = false;

	while (!isPlaced)
	{
		int randomX = rand() % LevelWidth;
		int randomY = rand() % LevelHeight;

		if (LevelGrid[std::make_pair(randomX, randomY)] == LEVEL_SEGMENT_BLANK)
		{
			LevelGrid[std::make_pair(randomX, randomY)] = LEVEL_SEGMENT_PLAYER_FOOD;
			LevelFoodLocation = std::make_pair(randomX, randomY);
			isPlaced = true;
		}
	}
}


void GameScreen::CollectFood()
{
	// TODO: Add points
	EntSnake->isFoodCollected = false;
	PlaceFood();
}


void GameScreen::Load()
{
	BaseScreen::Load();

	srand(time(NULL)); // Initialize random seed
{'fraction_non_alphanumeric': 0.12966175195143104, 'fraction_numerical': 0.009106678230702514, 'mean_word_length': 4.613138686131387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2540098', 'n_tokens_mistral': 886, 'n_tokens_neox': 819, 'n_words': 206}