<commit_before>#include "stdafx.h"
#include "Gameplay.h"
#include <iostream>

Gameplay::Gameplay(void) :
	_beginRoundTick(0.f),
	_ellipsisTick(0.f),
	_inRoundTick(0.f),
	_endRoundTick(0.f),
	_roundNumber(0),
	_gameplayState(BeginRound),
	_failed(false)
{
	_font.loadFromFile("fonts/arial.ttf");

	_roundNumberText.setFont(_font);
	_roundNumberText.setPosition(6, 6);
	_roundNumberText.setString("Round " + std::to_string(_roundNumber));

	_messageText.setFont(_font);
	_messageText.setStyle(sf::Text::Italic);
	_messageText.setCharacterSize(50);
	_messageText.setPosition(260, 208);
	_messageText.setString("Get ready");

	_timeText.setFont(_font);
	_timeText.setPosition(170, 70);
	_timeText.setCharacterSize(100);
	_timeText.setScale(4, 4);
	_timeText.setString("00");

	_timeCover.setFillColor(sf::Color(0, 0, 0, 200));
	_timeCover.setSize(sf::Vector2f(800, 600));

	_button.setFillColor(sf::Color::Green);
	_button.setPosition(100, 100);
	_button.setRadius(50);

	_toDraw.push_back(&_timeText);
	_toDraw.push_back(&_timeCover);
	_toDraw.push_back(&_roundNumberText);
	_toDraw.push_back(&_messageText);
}


Gameplay::~Gameplay(void)
{
}

void Gameplay::Update(double deltaTime)
{
	switch(_gameplayState)
	{
	case BeginRound:
		_beginRoundTick += deltaTime;
		_ellipsisTick += deltaTime;

		if (_ellipsisTick > .5)
		{
			_ellipsisTick = 0;

			_messageText.setString(_messageText.getString() + ".");
		}

		if (_beginRoundTick >= 2.f)
		{
			_beginRoundTick = 0;
			_ellipsisTick = 0;
			_inRoundTick = 0;

			_toDraw.erase(_toDraw.begin()+2, _toDraw.end());

			_gameplayState = InRound;
		}

		break;
	case InRound:
		_inRoundTick += deltaTime;

		if (_toDraw.size() < 3)
		{
			_toDraw.push_back(&_button);
		}

		_timeText.setString(std::to_string(_inRoundTick).substr(2, 2));

		if (_inRoundTick >= 1.f)
		{
			_failed = true;

			_timeText.setString("00");

			_gameplayState = EndRound;
		}

		break;
	case EndRound:
		_endRoundTick += deltaTime;

		if (_toDraw.size() < 3)
		{
			_toDraw.push_back(&_roundNumberText);
			_toDraw.push_back(&_messageText);
		}

		if (_endRoundTick >= 2.f)
		{
			_endRoundTick = 0.f;

			_messageText.setString("Get ready");

			_gameplayState = BeginRound;
		}

		break;
	}
}

void Gameplay::Draw(sf::RenderWindow& rw)
{
	std::vector<sf::Drawable*>::iterator end = _toDraw.end();
	for (std::vector<sf::Drawable*>::iterator it = _toDraw.begin(); it != end; it++)
	{
		rw.draw(**(it));
	}
}

void Gameplay::CheckMouseClick(sf::Vector2i pos)
{
	if (_gameplayState != InRound) return;

	sf::FloatRect buttonBounds = _button.getGlobalBounds();	
	
	if (buttonBounds.contains(pos.x, pos.y))
	{
		_failed = false;

		_roundNumber++;

		_timeText.setString("00");
		_messageText.setString("Good stuff!");
		_roundNumberText.setString("Round " + std::to_string(_roundNumber));

		_toDraw.pop_back();

		_gameplayState = EndRound;
	}
}

bool Gameplay::EndGame()
{
	if (_failed)
	{
		return true;
	}

	return false;
}<commit_msg>adding the random stuff now<commit_after>#include "stdafx.h"
#include "Gameplay.h"
#include <iostream>

Gameplay::Gameplay(void) :
	_beginRoundTick(0.f),
	_ellipsisTick(0.f),
	_inRoundTick(0.f),
	_endRoundTick(0.f),
	_roundNumber(0),
	_gameplayState(BeginRound),
	_failed(false)
{
	_font.loadFromFile("fonts/arial.ttf");

	_roundNumberText.setFont(_font);
	_roundNumberText.setPosition(6, 6);
	_roundNumberText.setString("Round " + std::to_string(_roundNumber));

	_messageText.setFont(_font);
	_messageText.setStyle(sf::Text::Italic);
	_messageText.setCharacterSize(50);
	_messageText.setPosition(260, 208);
	_messageText.setString("Get ready");

	_timeText.setFont(_font);
	_timeText.setPosition(170, 70);
	_timeText.setCharacterSize(100);
	_timeText.setScale(4, 4);
	_timeText.setString("00");

	_timeCover.setFillColor(sf::Color(0, 0, 0, 200));
	_timeCover.setSize(sf::Vector2f(800, 600));

	_button.setFillColor(sf::Color::Green);
	_button.setPosition(100, 100);
	_button.setRadius(50);

	_toDraw.push_back(&_timeText);
	_toDraw.push_back(&_timeCover);
	_toDraw.push_back(&_roundNumberText);
	_toDraw.push_back(&_messageText);

	srand(time(NULL));
}


Gameplay::~Gameplay(void)
{
}

void Gameplay::Update(double deltaTime)
{
	switch(_gameplayState)
	{
	case BeginRound:
		_beginRoundTick += deltaTime;
		_ellipsisTick += deltaTime;

		if (_ellipsisTick > .5)
		{
			_ellipsisTick = 0;

			_messageText.setString(_messageText.getString() + ".");
		}

		if (_beginRoundTick >= 2.f)
		{
			_beginRoundTick = 0;
			_ellipsisTick = 0;
			_inRoundTick = 0;

			_toDraw.erase(_toDraw.begin()+2, _toDraw.end());

			_gameplayState = InRound;
		}

		break;
	case InRound:
		_inRoundTick += deltaTime;

		if (_toDraw.size() < 3)
		{
			_toDraw.push_back(&_button);
		}

		_timeText.setString(std::to_string(_inRoundTick).substr(2, 2));

		if (_inRoundTick >= 1.f)
		{
			_failed = true;

			_timeText.setString("00");

			_gameplayState = EndRound;
		}

		break;
	case EndRound:
		_endRoundTick += deltaTime;

		if (_toDraw.size() < 3)
		{
			_toDraw.push_back(&_roundNumberText);
			_toDraw.push_back(&_messageText);
		}

		if (_endRoundTick >= 2.f)
		{
			_endRoundTick = 0.f;

			_messageText.setString("Get ready");

			_gameplayState = BeginRound;
		}

		break;
	}
}

void Gameplay::Draw(sf::RenderWindow& rw)
{
	std::vector<sf::Drawable*>::iterator end = _toDraw.end();
	for (std::vector<sf::Drawable*>::iterator it = _toDraw.begin(); it != end; it++)
	{
		rw.draw(**(it));
	}
}

void Gameplay::CheckMouseClick(sf::Vector2i pos)
{
	if (_gameplayState != InRound) return;

	sf::FloatRect buttonBounds = _button.getGlobalBounds();	
	
	if (buttonBounds.contains(pos.x, pos.y))
	{
		_failed = false;

		_roundNumber++;

		_timeText.setString("00");
		_messageText.setString("Good stuff!");
		_roundNumberText.setString("Round " + std::to_string(_roundNumber));

		_toDraw.pop_back();

		_gameplayState = EndRound;
	}
}

bool Gameplay::EndGame()
{
	if (_failed)
	{
		return true;
	}

	return false;
}
{'fraction_non_alphanumeric': 0.1589726372335068, 'fraction_numerical': 0.022494544233674668, 'mean_word_length': 4.969939879759519, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '4838959', 'n_tokens_mistral': 2613, 'n_tokens_neox': 2320, 'n_words': 331}