<commit_before>/*
 * Player.cpp
 *
 * contains implementations for Player specific functions
 * Player objects can use Item or use Skill objects
 */

#include <string>
#include <sstream>
#include <iomanip>
#include "Player.h"

//Player class: stores the player's name and Entity attributes
Player::Player(std::string name) : Entity(name) {
	_stamina = 100;
	_attack = 2;
	_defense = 0;
	learnSkill("Hack Solution", 99999);
}

Player::~Player() {
	for(unsigned int i = 0; i < _skills.size(); i++){
		delete _skills[i];
	}
}

//instruct the player to use the skill specified by input index
int Player::useSkill(int index) {
	return 0;
}

//instruct the player to use the item specified by input index
int Player::useItem(int index) {
	return 0;
}

//return the index of the skill named skillName, or -1 if the player does not possess that skill
int Player::skillIndex(std::string skillName) {
	int i = 0;
	for (std::vector<Skill*>::iterator itr = _skills.begin(); itr != _skills.end(); ++itr, ++i) {
		if ((*itr)->getName() == skillName) {
			return i;
		}
	}
	return -1;
}

//compile a string of advanced Player class information
std::string Player::getNonBasicInfo(std::ostream& ost) const {
	int colWidth = 15;
	//int count = 0;
	std::ostringstream ostr;<commit_msg>Fight skill selection string now case insensitive<commit_after>/*
 * Player.cpp
 *
 * contains implementations for Player specific functions
 * Player objects can use Item or use Skill objects
 */

#include <string>
#include <sstream>
#include <iomanip>
#include "Player.h"

//compare strings a and b, ignoring case sensitivity
bool equalsIgnoreCase(const std::string& a, const std::string& b) {
	unsigned int aSize = a.size();
	if (b.size() != aSize) {
		return false;
	}
	for (unsigned int i = 0; i < aSize; ++i) {
		if (tolower(a[i]) != tolower(b[i])) {
			return false;
		}
	}
	return true;
}

//Player class: stores the player's name and Entity attributes
Player::Player(std::string name) : Entity(name) {
	_stamina = 100;
	_attack = 2;
	_defense = 0;
	learnSkill("Hack Solution", 99999);
}

Player::~Player() {
	for(unsigned int i = 0; i < _skills.size(); i++){
		delete _skills[i];
	}
}

//instruct the player to use the skill specified by input index
int Player::useSkill(int index) {
	return 0;
}

//instruct the player to use the item specified by input index
int Player::useItem(int index) {
	return 0;
}

//return the index of the skill named skillName, or -1 if the player does not possess that skill
int Player::skillIndex(std::string skillName) {
	int i = 0;
	for (std::vector<Skill*>::iterator itr = _skills.begin(); itr != _skills.end(); ++itr, ++i) {
		if (equalsIgnoreCase((*itr)->getName(),skillName)) {
			return i;
		}
	}
	return -1;
}

//compile a string of advanced Player class information
std::string Player::getNonBasicInfo(std::ostream& ost) const {
	int colWidth = 15;
	//int count = 0;
	std::ostringstream ostr;
{'fraction_non_alphanumeric': 0.13686382393397525, 'fraction_numerical': 0.013411279229711142, 'mean_word_length': 4.279491833030853, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, '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': '2828601', 'n_tokens_mistral': 1022, 'n_tokens_neox': 972, 'n_words': 337}