Commits

David Stone committed ecbde74

Changed indentation of classes.

  • Participants
  • Parent commits 7f017d6

Comments (0)

Files changed (131)

source/ability.hpp

 class Weather;
 
 class Ability {
-	public:
-		enum Abilities : uint8_t {
-			ADAPTABILITY, AFTERMATH, AIR_LOCK, ANGER_POINT, ANTICIPATION,
-			ARENA_TRAP, BAD_DREAMS, BATTLE_ARMOR, BLAZE, CHLOROPHYLL,
-			CLEAR_BODY, CLOUD_NINE, COLOR_CHANGE, COMPOUNDEYES, CUTE_CHARM,
-			DAMP, DOWNLOAD, DRIZZLE, DROUGHT, DRY_SKIN,
-			EARLY_BIRD, EFFECT_SPORE, FILTER, FLAME_BODY, FLASH_FIRE,
-			FLOWER_GIFT, FORECAST, FOREWARN, FRISK, GLUTTONY,
-			GUTS, HEATPROOF, HONEY_GATHER, HUGE_POWER, HUSTLE,
-			HYDRATION, HYPER_CUTTER, ICE_BODY, ILLUMINATE, IMMUNITY,
-			INNER_FOCUS, INSOMNIA, INTIMIDATE, IRON_FIST, KEEN_EYE,
-			KLUTZ, LEAF_GUARD, LEVITATE, LIGHTNINGROD, LIMBER,
-			LIQUID_OOZE, MAGIC_GUARD, MAGMA_ARMOR, MAGNET_PULL, MARVEL_SCALE,
-			MINUS, MOLD_BREAKER, MOTOR_DRIVE, MULTITYPE, NATURAL_CURE,
-			NO_GUARD, NORMALIZE, OBLIVIOUS, OVERGROW, OWN_TEMPO,
-			PICKUP, PLUS, POISON_HEAL, POISON_POINT, PRESSURE,
-			PURE_POWER, QUICK_FEET, RAIN_DISH, RECKLESS, RIVALRY,
-			ROCK_HEAD, ROUGH_SKIN, RUN_AWAY, SAND_STREAM, SAND_VEIL,
-			SCRAPPY, SERENE_GRACE, SHADOW_TAG, SHED_SKIN, SHELL_ARMOR,
-			SHIELD_DUST, SIMPLE, SKILL_LINK, SLOW_START, SNIPER,
-			SNOW_CLOAK, SNOW_WARNING, SOLAR_POWER, SOLID_ROCK, SOUNDPROOF,
-			SPEED_BOOST, STALL, STATIC, STEADFAST, STENCH,
-			STICKY_HOLD, STORM_DRAIN, STURDY, SUCTION_CUPS, SUPER_LUCK,
-			SWARM, SWIFT_SWIM, SYNCHRONIZE, TANGLED_FEET, TECHNICIAN,
-			THICK_FAT, TINTED_LENS, TORRENT, TRACE, TRUANT,
-			UNAWARE, UNBURDEN, VITAL_SPIRIT, VOLT_ABSORB, WATER_ABSORB,
-			WATER_VEIL, WHITE_SMOKE, WONDER_GUARD, END
-		};
-		Ability ();
-		explicit Ability (Abilities ability);
-		explicit Ability (std::string const & str);
-		bool is_set () const;
-		void set_if_unknown (Abilities ability);
-		bool blocks_switching (ActivePokemon const & switcher, Weather const & weather) const;
-		bool blocks_weather () const;
+public:
+	enum Abilities : uint8_t {
+		ADAPTABILITY, AFTERMATH, AIR_LOCK, ANGER_POINT, ANTICIPATION,
+		ARENA_TRAP, BAD_DREAMS, BATTLE_ARMOR, BLAZE, CHLOROPHYLL,
+		CLEAR_BODY, CLOUD_NINE, COLOR_CHANGE, COMPOUNDEYES, CUTE_CHARM,
+		DAMP, DOWNLOAD, DRIZZLE, DROUGHT, DRY_SKIN,
+		EARLY_BIRD, EFFECT_SPORE, FILTER, FLAME_BODY, FLASH_FIRE,
+		FLOWER_GIFT, FORECAST, FOREWARN, FRISK, GLUTTONY,
+		GUTS, HEATPROOF, HONEY_GATHER, HUGE_POWER, HUSTLE,
+		HYDRATION, HYPER_CUTTER, ICE_BODY, ILLUMINATE, IMMUNITY,
+		INNER_FOCUS, INSOMNIA, INTIMIDATE, IRON_FIST, KEEN_EYE,
+		KLUTZ, LEAF_GUARD, LEVITATE, LIGHTNINGROD, LIMBER,
+		LIQUID_OOZE, MAGIC_GUARD, MAGMA_ARMOR, MAGNET_PULL, MARVEL_SCALE,
+		MINUS, MOLD_BREAKER, MOTOR_DRIVE, MULTITYPE, NATURAL_CURE,
+		NO_GUARD, NORMALIZE, OBLIVIOUS, OVERGROW, OWN_TEMPO,
+		PICKUP, PLUS, POISON_HEAL, POISON_POINT, PRESSURE,
+		PURE_POWER, QUICK_FEET, RAIN_DISH, RECKLESS, RIVALRY,
+		ROCK_HEAD, ROUGH_SKIN, RUN_AWAY, SAND_STREAM, SAND_VEIL,
+		SCRAPPY, SERENE_GRACE, SHADOW_TAG, SHED_SKIN, SHELL_ARMOR,
+		SHIELD_DUST, SIMPLE, SKILL_LINK, SLOW_START, SNIPER,
+		SNOW_CLOAK, SNOW_WARNING, SOLAR_POWER, SOLID_ROCK, SOUNDPROOF,
+		SPEED_BOOST, STALL, STATIC, STEADFAST, STENCH,
+		STICKY_HOLD, STORM_DRAIN, STURDY, SUCTION_CUPS, SUPER_LUCK,
+		SWARM, SWIFT_SWIM, SYNCHRONIZE, TANGLED_FEET, TECHNICIAN,
+		THICK_FAT, TINTED_LENS, TORRENT, TRACE, TRUANT,
+		UNAWARE, UNBURDEN, VITAL_SPIRIT, VOLT_ABSORB, WATER_ABSORB,
+		WATER_VEIL, WHITE_SMOKE, WONDER_GUARD, END
+	};
+	Ability ();
+	explicit Ability (Abilities ability);
+	explicit Ability (std::string const & str);
+	bool is_set () const;
+	void set_if_unknown (Abilities ability);
+	bool blocks_switching (ActivePokemon const & switcher, Weather const & weather) const;
+	bool blocks_weather () const;
 
-		template<Status::Statuses status>
-		bool blocks_status (Weather const & weather) const;
-		bool blocks_confusion () const;
-		bool reflects_status () const;
-		bool absorbs_poison_damage () const;
-		bool blocks_burn_damage_penalty () const;
-		bool blocks_paralysis_speed_penalty () const;
-		bool can_clear_status (Status status) const;
-		bool clears_status_on_switch () const;
-		bool is_immune_to_ground () const;
-		bool wakes_up_early () const;
-		bool weakens_burn () const;
-		
-		bool harms_sleepers () const;
+	template<Status::Statuses status>
+	bool blocks_status (Weather const & weather) const;
+	bool blocks_confusion () const;
+	bool reflects_status () const;
+	bool absorbs_poison_damage () const;
+	bool blocks_burn_damage_penalty () const;
+	bool blocks_paralysis_speed_penalty () const;
+	bool can_clear_status (Status status) const;
+	bool clears_status_on_switch () const;
+	bool is_immune_to_ground () const;
+	bool wakes_up_early () const;
+	bool weakens_burn () const;
+	
+	bool harms_sleepers () const;
 
-		bool blocks_phazing () const;
-		bool blocks_recoil () const;
-		bool blocks_secondary_damage () const;
-		bool blocks_sound_moves () const;
-		bool cannot_miss () const;
-		bool damages_leechers () const;
-		bool weakens_se_attacks () const;
-		bool strengthens_nve_attacks () const;
-		bool uses_extra_pp() const;
-		bool ignores_blockers () const;
-		
-		bool boosts_critical_hits () const;
-		bool boosts_defense (Status status) const;
-		bool boosts_special_attack (Weather const & weather) const;
-		bool boosts_special_defense (Weather const & weather) const;
-		bool boosts_speed () const;
-		bool boosts_speed_when_flinched () const;
-		bool boosts_stab () const;
-		
-		bool is_loafing (bool loaf) const;
-		std::string to_string () const;
-		
-		static void activate_on_switch (ActivePokemon & switcher, ActivePokemon & other, Weather & weather);
-		friend bool operator== (Ability lhs, Ability rhs);
-		Abilities name;
+	bool blocks_phazing () const;
+	bool blocks_recoil () const;
+	bool blocks_secondary_damage () const;
+	bool blocks_sound_moves () const;
+	bool cannot_miss () const;
+	bool damages_leechers () const;
+	bool weakens_se_attacks () const;
+	bool strengthens_nve_attacks () const;
+	bool uses_extra_pp() const;
+	bool ignores_blockers () const;
+	
+	bool boosts_critical_hits () const;
+	bool boosts_defense (Status status) const;
+	bool boosts_special_attack (Weather const & weather) const;
+	bool boosts_special_defense (Weather const & weather) const;
+	bool boosts_speed () const;
+	bool boosts_speed_when_flinched () const;
+	bool boosts_stab () const;
+	
+	bool is_loafing (bool loaf) const;
+	std::string to_string () const;
+	
+	static void activate_on_switch (ActivePokemon & switcher, ActivePokemon & other, Weather & weather);
+	friend bool operator== (Ability lhs, Ability rhs);
+	Abilities name;
 };
 bool operator!= (Ability lhs, Ability rhs);
 

source/bide/bide.hpp

 namespace technicalmachine {
 
 class Bide {
-	public:
-		friend bool operator== (Bide const & lhs, Bide const & rhs);
-		bool is_active() const;
-		void activate();
-		void add_damage(unsigned extra_damage);
-		void reset();
-		// Returns the damage released by Bide (or 0 if none)
-		unsigned decrement();
-		typedef uint64_t hash_type;
-		hash_type hash() const;
-		static hash_type max_hash();
-	private:
-		BideDamage damage;
-		BideDuration duration;
+public:
+	friend bool operator== (Bide const & lhs, Bide const & rhs);
+	bool is_active() const;
+	void activate();
+	void add_damage(unsigned extra_damage);
+	void reset();
+	// Returns the damage released by Bide (or 0 if none)
+	unsigned decrement();
+	typedef uint64_t hash_type;
+	hash_type hash() const;
+	static hash_type max_hash();
+private:
+	BideDamage damage;
+	BideDuration duration;
 };
 
 bool operator!= (Bide const & lhs, Bide const & rhs);

source/bide/damage.hpp

 namespace technicalmachine {
 
 class BideDamage {
-	public:
-		BideDamage();
-		void add(unsigned extra_damage);
-		unsigned release();
-		friend bool operator== (BideDamage const & lhs, BideDamage const & rhs);
-		typedef uint64_t hash_type;
-		hash_type hash() const;
-		static hash_type max_hash();
-	private:
-		uint16_t damage;
+public:
+	BideDamage();
+	void add(unsigned extra_damage);
+	unsigned release();
+	friend bool operator== (BideDamage const & lhs, BideDamage const & rhs);
+	typedef uint64_t hash_type;
+	hash_type hash() const;
+	static hash_type max_hash();
+private:
+	uint16_t damage;
 };
 
 bool operator!= (BideDamage const & lhs, BideDamage const & rhs);

source/bide/duration.hpp

 namespace technicalmachine {
 
 class BideDuration {
-	public:
-		BideDuration();
-		void activate();
-		explicit operator bool() const;
-		// returns whether Bide releases damage
-		bool decrement();
-		friend bool operator== (BideDuration const & lhs, BideDuration const & rhs);
-		typedef uint64_t hash_type;
-		hash_type hash() const;
-		static hash_type max_hash();
-	private:
-		uint8_t turns_until_activation;
+public:
+	BideDuration();
+	void activate();
+	explicit operator bool() const;
+	// returns whether Bide releases damage
+	bool decrement();
+	friend bool operator== (BideDuration const & lhs, BideDuration const & rhs);
+	typedef uint64_t hash_type;
+	hash_type hash() const;
+	static hash_type max_hash();
+private:
+	uint8_t turns_until_activation;
 };
 
 bool operator!= (BideDuration const & lhs, BideDuration const & rhs);
 class Weather;
 
 class LegalSelections {
-		typedef std::vector<Move const *> Container;
-	public:
-		typedef Container::const_iterator const_iterator;
-		LegalSelections(ActivePokemon const & user, ActivePokemon const & other, Weather const & weather);
-		Species species() const;
-		const_iterator begin() const;
-		const_iterator end() const;
-		size_t size() const;
-		Move const * const & operator[] (size_t index) const;
-	private:
-		Container container;
-		Species m_species;
+	typedef std::vector<Move const *> Container;
+public:
+	typedef Container::const_iterator const_iterator;
+	LegalSelections(ActivePokemon const & user, ActivePokemon const & other, Weather const & weather);
+	Species species() const;
+	const_iterator begin() const;
+	const_iterator end() const;
+	size_t size() const;
+	Move const * const & operator[] (size_t index) const;
+private:
+	Container container;
+	Species m_species;
 };
 
 bool can_execute_move (ActivePokemon & user, ActivePokemon const & other, Weather const & weather);

source/clients/battle.hpp

 } // namespace network
 
 class Battle {
-	public:
-		bool is_me (Party other_party) const;
-		void set_party_if_unknown(Party new_party);
-		void write_team (network::OutMessage & msg, std::string const & username = std::string()) const;
-		Team predict_foe_team (DetailedStats const & detailed) const;
-		void handle_begin_turn (uint16_t turn_count) const;
-		void handle_request_action(DetailedStats const & detailed, Evaluate const & evaluate, network::OutMessage & msg, uint32_t battle_id, bool can_switch, std::vector <uint8_t> const & attacks_allowed, bool forced = false);
-		void handle_use_move (Party user, uint8_t slot, Moves move_name);
-		void handle_send_out (Party switcher, uint8_t slot, uint8_t index, std::string const & nickname, Species species, Gender gender, uint8_t level);
-		void handle_set_pp (Party changer, uint8_t slot, uint8_t pp);
-		void handle_fainted (Party fainter, uint8_t slot);
-		void handle_end (Client const & client, Result const result) const;
-		std::string const & opponent() const;
-		Battle(Battle const &) = delete;
-		Battle & operator= (Battle const &) = delete;
-		void handle_hp_change(Party changer, uint8_t slot, unsigned remaining_hp);
-		bool is_valid_hp_change(Party changer, unsigned remaining_hp, int received_change) const;
-		bool is_valid_precision(Party changer, unsigned precision) const;
-		void handle_direct_damage(Party const damaged, uint8_t slot, unsigned damage);
-		virtual ~Battle() {}
-	protected:
-		Battle(std::string const & _opponent, std::random_device::result_type seed, unsigned battle_depth, std::string const & team_file_name);
-		Battle(std::string const & _opponent, std::random_device::result_type seed, unsigned battle_depth, Team const & team);
-		uint8_t switch_slot (Moves move) const;
-		virtual uint16_t max_damage_precision () const;
-		void initialize_turn ();
-		int hp_change (Party changing, unsigned remaining_hp) const;
-		unsigned max_visible_hp_change(Party changer) const;
-		void handle_flinch(Party party);
-		void handle_miss(Party party);
-		void handle_critical_hit(Party party);
-		void handle_ability_message(Party party, Ability::Abilities ability);
-		void handle_item_message(Party party, Item::Items item);
-		void slot_memory_bring_to_front();
-	private:
-		void initialize();
-		Moves determine_action(DetailedStats const & detailed, Evaluate const & evaluate);
-		void correct_hp_and_report_errors (Team & team);
-		void normalize_hp ();
-		void normalize_hp(Team & team);
-		unsigned max_visible_hp_change(Team const & changer) const;
-		unsigned max_visible_hp_change(bool my_pokemon, Pokemon const & changer) const;
-		void do_turn ();
-		void update_from_previous_turn();
-		Team const & get_team(Party party) const;
-		Team & get_team(Party party);
-		Variable const & variable(Team const & team) const;
-		Variable & variable(Team const & team);
-		void register_damage();
+public:
+	bool is_me (Party other_party) const;
+	void set_party_if_unknown(Party new_party);
+	void write_team (network::OutMessage & msg, std::string const & username = std::string()) const;
+	Team predict_foe_team (DetailedStats const & detailed) const;
+	void handle_begin_turn (uint16_t turn_count) const;
+	void handle_request_action(DetailedStats const & detailed, Evaluate const & evaluate, network::OutMessage & msg, uint32_t battle_id, bool can_switch, std::vector <uint8_t> const & attacks_allowed, bool forced = false);
+	void handle_use_move (Party user, uint8_t slot, Moves move_name);
+	void handle_send_out (Party switcher, uint8_t slot, uint8_t index, std::string const & nickname, Species species, Gender gender, uint8_t level);
+	void handle_set_pp (Party changer, uint8_t slot, uint8_t pp);
+	void handle_fainted (Party fainter, uint8_t slot);
+	void handle_end (Client const & client, Result const result) const;
+	std::string const & opponent() const;
+	Battle(Battle const &) = delete;
+	Battle & operator= (Battle const &) = delete;
+	void handle_hp_change(Party changer, uint8_t slot, unsigned remaining_hp);
+	bool is_valid_hp_change(Party changer, unsigned remaining_hp, int received_change) const;
+	bool is_valid_precision(Party changer, unsigned precision) const;
+	void handle_direct_damage(Party const damaged, uint8_t slot, unsigned damage);
+	virtual ~Battle() {}
+protected:
+	Battle(std::string const & _opponent, std::random_device::result_type seed, unsigned battle_depth, std::string const & team_file_name);
+	Battle(std::string const & _opponent, std::random_device::result_type seed, unsigned battle_depth, Team const & team);
+	uint8_t switch_slot (Moves move) const;
+	virtual uint16_t max_damage_precision () const;
+	void initialize_turn ();
+	int hp_change (Party changing, unsigned remaining_hp) const;
+	unsigned max_visible_hp_change(Party changer) const;
+	void handle_flinch(Party party);
+	void handle_miss(Party party);
+	void handle_critical_hit(Party party);
+	void handle_ability_message(Party party, Ability::Abilities ability);
+	void handle_item_message(Party party, Item::Items item);
+	void slot_memory_bring_to_front();
+private:
+	void initialize();
+	Moves determine_action(DetailedStats const & detailed, Evaluate const & evaluate);
+	void correct_hp_and_report_errors (Team & team);
+	void normalize_hp ();
+	void normalize_hp(Team & team);
+	unsigned max_visible_hp_change(Team const & changer) const;
+	unsigned max_visible_hp_change(bool my_pokemon, Pokemon const & changer) const;
+	void do_turn ();
+	void update_from_previous_turn();
+	Team const & get_team(Party party) const;
+	Team & get_team(Party party);
+	Variable const & variable(Team const & team) const;
+	Variable & variable(Team const & team);
+	void register_damage();
 
-		std::string opponent_name;
-		mutable std::mt19937 random_engine;
-		Team ai;
-		Team foe;
-		std::vector <Species> slot_memory;
-		UpdatedHP updated_hp;
-		Weather weather;
-		Team * first;
-		Team * last;
-		Variable ai_variable;
-		Variable foe_variable;
-		unsigned depth;
-		bool move_damage;
-		Party my_party;
+	std::string opponent_name;
+	mutable std::mt19937 random_engine;
+	Team ai;
+	Team foe;
+	std::vector <Species> slot_memory;
+	UpdatedHP updated_hp;
+	Weather weather;
+	Team * first;
+	Team * last;
+	Variable ai_variable;
+	Variable foe_variable;
+	unsigned depth;
+	bool move_damage;
+	Party my_party;
 };
 
 }	// namespace technicalmachine

source/clients/battle_settings.hpp

 namespace technicalmachine {
 
 class BattleSettings {
-	public:
-		virtual bool are_acceptable () const = 0;
-		virtual ~BattleSettings () {}
+public:
+	virtual bool are_acceptable () const = 0;
+	virtual ~BattleSettings () {}
 };
 
 }	// namespace technicalmachine

source/clients/battles.hpp

 namespace technicalmachine {
 
 class Battles {
-	public:
-		template<typename SpecificBattle, typename ... Args>
-		SpecificBattle const & add_pending_challenge(std::string const & opponent, Args && ... args) {
-			Pointer battle_ptr(new SpecificBattle(opponent, std::forward<Args>(args)...));
-			auto const & battle = static_cast<SpecificBattle const &>(*battle_ptr);
-			challenges.insert(std::make_pair(opponent, std::move(battle_ptr)));
-			return battle;
-		}
-		void handle_challenge_withdrawn();
-		void handle_challenge_withdrawn(std::string const & opponent);
-		Battle & handle_begin(uint32_t battle_id, std::string const & opponent);
-		void handle_end(uint32_t battle_id);
-		Battle const & find(uint32_t battle_id) const;
-		Battle & find(uint32_t battle_id);
-		bool challenges_are_queued() const;
-		std::string const & first_challenger() const;
-	private:
-		typedef std::unique_ptr<Battle> Pointer;
-		// Battles that have not yet begun
-		typedef std::map<std::string, Pointer> Challenges;
-		// Battles currently underway
-		typedef std::map<uint32_t, Pointer> Active;
-		Challenges challenges;
-		Active active;
+public:
+	template<typename SpecificBattle, typename ... Args>
+	SpecificBattle const & add_pending_challenge(std::string const & opponent, Args && ... args) {
+		Pointer battle_ptr(new SpecificBattle(opponent, std::forward<Args>(args)...));
+		auto const & battle = static_cast<SpecificBattle const &>(*battle_ptr);
+		challenges.insert(std::make_pair(opponent, std::move(battle_ptr)));
+		return battle;
+	}
+	void handle_challenge_withdrawn();
+	void handle_challenge_withdrawn(std::string const & opponent);
+	Battle & handle_begin(uint32_t battle_id, std::string const & opponent);
+	void handle_end(uint32_t battle_id);
+	Battle const & find(uint32_t battle_id) const;
+	Battle & find(uint32_t battle_id);
+	bool challenges_are_queued() const;
+	std::string const & first_challenger() const;
+private:
+	typedef std::unique_ptr<Battle> Pointer;
+	// Battles that have not yet begun
+	typedef std::map<std::string, Pointer> Challenges;
+	// Battles currently underway
+	typedef std::map<uint32_t, Pointer> Active;
+	Challenges challenges;
+	Active active;
 };
 
 }	// namespace technicalmachine

source/clients/client.hpp

 class BattleSettings;
 
 class Client {
-	public:
-		void print_with_time_stamp(std::ostream & stream, std::string const & message) const;
-		DetailedStats const & detailed() const;
-		Evaluate const & evaluation_constants() const;
-		virtual ~Client() { }
-		void handle_incoming_challenge(std::string const & opponent, BattleSettings const & settings);
-	protected:
-		explicit Client(unsigned depth);
-		void set_depth(unsigned new_depth);
-		Settings load_settings(bool reload);
-		Team generate_team();
-		template<typename ... Args>
-		void handle_challenge_withdrawn(Args && ... args) {
-			return battles.handle_challenge_withdrawn(std::forward<Args>(args)...);
-		}
-		virtual void handle_finalize_challenge(std::string const & opponent, bool accepted, bool challenger) = 0;
-		void handle_battle_begin(uint32_t battle_id, std::string const & opponent, Party party = Party());
-		void handle_battle_end(uint32_t battle_id, Result result);
-		template<typename ... Args>
-		Battle const & find_battle(Args && ... args) const {
-			return battles.find(std::forward<Args>(args)...);
-		}
-		template<typename ... Args>
-		Battle & find_battle(Args && ... args) {
-			return battles.find(std::forward<Args>(args)...);
-		}
-		template<typename Battle, typename ... Args>
-		Battle const & add_pending_challenge (Team const & team, std::string const & opponent, Args && ... args) {
-			return battles.add_pending_challenge<Battle>(opponent, rd(), m_depth, std::forward<Args>(args)..., team);
-		}
-		template<typename Battle, typename ... Args>
-		Battle const & add_pending_challenge (std::string const & opponent, Args && ... args) {
-			return battles.add_pending_challenge<Battle>(opponent, rd(), m_depth, std::forward<Args>(args)..., team_file_name);
-		}
-		bool challenges_are_queued() const;
-		std::string const & first_challenger() const;
-		std::string random_string(size_t size);
-		virtual void send_battle_challenge(std::string const & opponent) = 0;
-	private:
-		typedef std::mt19937 RandomEngine;
-		std::string time_stamp() const;
-		std::random_device rd;
-		RandomEngine random_engine;
-		Battles battles;
-		DetailedStats detailed_stats;
-		Evaluate m_evaluation_constants;
-		std::string team_file_name;
-		std::string time_format;
-		unsigned m_depth;
+public:
+	void print_with_time_stamp(std::ostream & stream, std::string const & message) const;
+	DetailedStats const & detailed() const;
+	Evaluate const & evaluation_constants() const;
+	virtual ~Client() { }
+	void handle_incoming_challenge(std::string const & opponent, BattleSettings const & settings);
+protected:
+	explicit Client(unsigned depth);
+	void set_depth(unsigned new_depth);
+	Settings load_settings(bool reload);
+	Team generate_team();
+	template<typename ... Args>
+	void handle_challenge_withdrawn(Args && ... args) {
+		return battles.handle_challenge_withdrawn(std::forward<Args>(args)...);
+	}
+	virtual void handle_finalize_challenge(std::string const & opponent, bool accepted, bool challenger) = 0;
+	void handle_battle_begin(uint32_t battle_id, std::string const & opponent, Party party = Party());
+	void handle_battle_end(uint32_t battle_id, Result result);
+	template<typename ... Args>
+	Battle const & find_battle(Args && ... args) const {
+		return battles.find(std::forward<Args>(args)...);
+	}
+	template<typename ... Args>
+	Battle & find_battle(Args && ... args) {
+		return battles.find(std::forward<Args>(args)...);
+	}
+	template<typename Battle, typename ... Args>
+	Battle const & add_pending_challenge (Team const & team, std::string const & opponent, Args && ... args) {
+		return battles.add_pending_challenge<Battle>(opponent, rd(), m_depth, std::forward<Args>(args)..., team);
+	}
+	template<typename Battle, typename ... Args>
+	Battle const & add_pending_challenge (std::string const & opponent, Args && ... args) {
+		return battles.add_pending_challenge<Battle>(opponent, rd(), m_depth, std::forward<Args>(args)..., team_file_name);
+	}
+	bool challenges_are_queued() const;
+	std::string const & first_challenger() const;
+	std::string random_string(size_t size);
+	virtual void send_battle_challenge(std::string const & opponent) = 0;
+private:
+	typedef std::mt19937 RandomEngine;
+	std::string time_stamp() const;
+	std::random_device rd;
+	RandomEngine random_engine;
+	Battles battles;
+	DetailedStats detailed_stats;
+	Evaluate m_evaluation_constants;
+	std::string team_file_name;
+	std::string time_format;
+	unsigned m_depth;
 };
 
 }	// namespace technicalmachine

source/clients/invalid_team_file_format.hpp

 namespace technicalmachine {
 
 class InvalidTeamFileFormat : public std::logic_error {
-	public:
-		explicit InvalidTeamFileFormat(std::string const & file);
+public:
+	explicit InvalidTeamFileFormat(std::string const & file);
 };
 }	// namespace technicalmachine
 #endif	// INVALID_TEAM_FILE_FORMAT_HPP_

source/clients/network/buffer_overrun.hpp

 namespace network {
 
 class BufferOverrun : public InvalidPacket {
-	public:
-		BufferOverrun();
+public:
+	BufferOverrun();
 };
 }	// namespace network
 }	// namespace technicalmachine

source/clients/network/client.hpp

 
 class Client : public ::technicalmachine::Client {
 	typedef ::technicalmachine::Client Base;
-	public:
-		void handle_channel_message (uint32_t channel_id, std::string const & user, std::string const & message) const;
-		void send_message(OutMessage & msg);
-	protected:
-		explicit Client(unsigned depth);
-		void reconnect ();
-		virtual void send_channel_message(std::string const & channel, std::string const & message) = 0;
-		virtual void send_channel_message(uint32_t channel_id, std::string const & message) = 0;
-		virtual void send_private_message(std::string const & user, std::string const & message) = 0;
-		void read_header(InMessage & msg);
-		template<typename SimulatorInMessage>
-		void run_main_service() {
-			SimulatorInMessage msg;
-			read_header(msg);
-			io.run();
-		}
-		std::string const & username() const;
-		std::string const & password() const;
-		void handle_server_message (std::string const & sender, std::string const & message) const;
-		template<typename Battle, typename ... Args>
-		Battle const & add_pending_challenge(Args && ... args) {
-			return Base::add_pending_challenge<Battle>(std::forward<Args>(args)...);
-		}
-		template<typename Timer>
-		std::unique_ptr<Timer> make_timer() {
-			return std::unique_ptr<Timer>(new Timer(io));
-		}
-		void handle_private_message (std::string const & sender, std::string const & message);
-	private:
-		bool is_trusted (std::string const & user) const;
-		void load_settings (bool reloading);
-		void connect ();
-		virtual void send_keep_alive_message () = 0;
-		virtual void join_channel (std::string const & channel) = 0;
-		virtual void part_channel (std::string const & channel) = 0;
-		bool is_highlighted (std::string const & message) const;
-		void do_request (std::string const & user, std::string const & request);
-		void handle_challenge_command (std::string const & request, size_t start);
-		void handle_depth_change_command (std::string const & user, std::string const & request, size_t start);
-		void handle_join_channel_command (std::string const & request, size_t start);
-		void handle_send_message_command (std::string const & request, size_t start);
-		void handle_part_channel_command (std::string const & request, size_t start);
-		void handle_send_pm_command (std::string const & request, size_t start);
-		void handle_reload_settings_command ();
+public:
+	void handle_channel_message (uint32_t channel_id, std::string const & user, std::string const & message) const;
+	void send_message(OutMessage & msg);
+protected:
+	explicit Client(unsigned depth);
+	void reconnect ();
+	virtual void send_channel_message(std::string const & channel, std::string const & message) = 0;
+	virtual void send_channel_message(uint32_t channel_id, std::string const & message) = 0;
+	virtual void send_private_message(std::string const & user, std::string const & message) = 0;
+	void read_header(InMessage & msg);
+	template<typename SimulatorInMessage>
+	void run_main_service() {
+		SimulatorInMessage msg;
+		read_header(msg);
+		io.run();
+	}
+	std::string const & username() const;
+	std::string const & password() const;
+	void handle_server_message (std::string const & sender, std::string const & message) const;
+	template<typename Battle, typename ... Args>
+	Battle const & add_pending_challenge(Args && ... args) {
+		return Base::add_pending_challenge<Battle>(std::forward<Args>(args)...);
+	}
+	template<typename Timer>
+	std::unique_ptr<Timer> make_timer() {
+		return std::unique_ptr<Timer>(new Timer(io));
+	}
+	void handle_private_message (std::string const & sender, std::string const & message);
+private:
+	bool is_trusted (std::string const & user) const;
+	void load_settings (bool reloading);
+	void connect ();
+	virtual void send_keep_alive_message () = 0;
+	virtual void join_channel (std::string const & channel) = 0;
+	virtual void part_channel (std::string const & channel) = 0;
+	bool is_highlighted (std::string const & message) const;
+	void do_request (std::string const & user, std::string const & request);
+	void handle_challenge_command (std::string const & request, size_t start);
+	void handle_depth_change_command (std::string const & user, std::string const & request, size_t start);
+	void handle_join_channel_command (std::string const & request, size_t start);
+	void handle_send_message_command (std::string const & request, size_t start);
+	void handle_part_channel_command (std::string const & request, size_t start);
+	void handle_send_pm_command (std::string const & request, size_t start);
+	void handle_reload_settings_command ();
 
-		boost::asio::io_service io;
-		std::string host;
-		std::string port;
-		std::unique_ptr<boost::asio::ip::tcp::socket> socket;
-		std::string current_username;
-		std::string current_password;
-		std::vector <std::string> highlights;
-		std::vector <std::string> trusted_users;
-		unsigned chattiness;
+	boost::asio::io_service io;
+	std::string host;
+	std::string port;
+	std::unique_ptr<boost::asio::ip::tcp::socket> socket;
+	std::string current_username;
+	std::string current_password;
+	std::vector <std::string> highlights;
+	std::vector <std::string> trusted_users;
+	unsigned chattiness;
 };
 
 }	// namespace network

source/clients/network/inmessage.hpp

 class Client;
 
 class InMessage {
-	public:
-		std::vector <uint8_t> buffer;
-		size_t index;
-	public:
-		InMessage ();
-		virtual ~InMessage() {}
-		void reset (size_t bytes);
-		uint8_t read_byte ();
-		uint16_t read_short ();
-		uint32_t read_int ();
-		void read_header(boost::asio::ip::tcp::socket & socket, Client * client);
-	private:
-		uint32_t read_bytes (size_t bytes);
-		virtual size_t header_size() const = 0;
-		virtual void read_body (boost::asio::ip::tcp::socket & socket, Client * client) = 0;
+public:
+	std::vector <uint8_t> buffer;
+	size_t index;
+public:
+	InMessage ();
+	virtual ~InMessage() {}
+	void reset (size_t bytes);
+	uint8_t read_byte ();
+	uint16_t read_short ();
+	uint32_t read_int ();
+	void read_header(boost::asio::ip::tcp::socket & socket, Client * client);
+private:
+	uint32_t read_bytes (size_t bytes);
+	virtual size_t header_size() const = 0;
+	virtual void read_body (boost::asio::ip::tcp::socket & socket, Client * client) = 0;
 };
 
 }	// namespace network

source/clients/network/invalid_channel.hpp

 namespace network {
 
 class InvalidChannel : public std::runtime_error {
-	public:
-		explicit InvalidChannel(std::string const & channel);
+public:
+	explicit InvalidChannel(std::string const & channel);
 };
 
 }	// namespace network

source/clients/network/invalid_packet.hpp

 namespace network {
 
 class InvalidPacket : public std::runtime_error {
-	public:
-		explicit InvalidPacket(std::string const & reason);
+public:
+	explicit InvalidPacket(std::string const & reason);
 };
 }	// namespace network
 }	// namespace technicalmachine

source/clients/network/invalid_simulator_data.hpp

 namespace network {
 
 class InvalidSimulatorData : public InvalidPacket {
-	public:
-		template<typename Integer, typename boost::enable_if_c<sizeof(Integer) <= 4, int>::type = 0>
-		InvalidSimulatorData (Integer const received, Integer const minimum, Integer const maximum, std::string const & variable):
-			InvalidPacket (variable + " should be between " + std::to_string(static_cast<int64_t>(minimum)) + " and " + std::to_string(static_cast<int64_t>(maximum)) + ", but the server sent a value of " + std::to_string(static_cast<int64_t>(received)) + ".") {
-		}
-		template<typename Integer, typename boost::enable_if_c<sizeof(Integer) <= 4, int>::type = 0>
-		InvalidSimulatorData(Integer const received, std::string const & variable):
-			InvalidPacket ("Recieved an invalid value of " + std::to_string(static_cast<int64_t>(received)) + " for " + variable + ".") {
-		}
+public:
+	template<typename Integer, typename boost::enable_if_c<sizeof(Integer) <= 4, int>::type = 0>
+	InvalidSimulatorData (Integer const received, Integer const minimum, Integer const maximum, std::string const & variable):
+		InvalidPacket (variable + " should be between " + std::to_string(static_cast<int64_t>(minimum)) + " and " + std::to_string(static_cast<int64_t>(maximum)) + ", but the server sent a value of " + std::to_string(static_cast<int64_t>(received)) + ".") {
+	}
+	template<typename Integer, typename boost::enable_if_c<sizeof(Integer) <= 4, int>::type = 0>
+	InvalidSimulatorData(Integer const received, std::string const & variable):
+		InvalidPacket ("Recieved an invalid value of " + std::to_string(static_cast<int64_t>(received)) + " for " + variable + ".") {
+	}
 };
 }	// namespace network
 }	// namespace technicalmachine

source/clients/network/outmessage.hpp

 namespace network {
 
 class OutMessage {
-	public:
-		explicit OutMessage (uint8_t code);
-		virtual ~OutMessage () {}
-		template<typename Integer>
-		void write_bytes(Integer bytes);
-		// The next three are the same as above for sizeof(Integer) = 1, 2, 4
-		void write_byte (uint8_t byte);
-		void write_short (uint16_t bytes);
-		void write_int (uint32_t bytes);
-		virtual void write_string (std::string const & str) = 0;
-		virtual void write_move (uint32_t battle_id, uint8_t move_index, uint8_t target = 1) = 0;
-		virtual void write_switch (uint32_t battle_id, uint8_t slot) = 0;
-		virtual void write_team (Team const & team, std::string const & = std::string()) = 0;
-		virtual void finalize() = 0;
-		void send(boost::asio::ip::tcp::socket & socket);
-		std::vector <uint8_t> buffer;
+public:
+	explicit OutMessage (uint8_t code);
+	virtual ~OutMessage () {}
+	template<typename Integer>
+	void write_bytes(Integer bytes);
+	// The next three are the same as above for sizeof(Integer) = 1, 2, 4
+	void write_byte (uint8_t byte);
+	void write_short (uint16_t bytes);
+	void write_int (uint32_t bytes);
+	virtual void write_string (std::string const & str) = 0;
+	virtual void write_move (uint32_t battle_id, uint8_t move_index, uint8_t target = 1) = 0;
+	virtual void write_switch (uint32_t battle_id, uint8_t slot) = 0;
+	virtual void write_team (Team const & team, std::string const & = std::string()) = 0;
+	virtual void finalize() = 0;
+	void send(boost::asio::ip::tcp::socket & socket);
+	std::vector <uint8_t> buffer;
 };
 
 }	// namespace technicalmachine

source/clients/no_pending_challenges.hpp

 namespace technicalmachine {
 
 class NoPendingChallenges : public std::runtime_error {
-	public:
-		NoPendingChallenges();
-		explicit NoPendingChallenges(std::string const & name);
-		explicit NoPendingChallenges(uint32_t const id);
+public:
+	NoPendingChallenges();
+	explicit NoPendingChallenges(std::string const & name);
+	explicit NoPendingChallenges(uint32_t const id);
 };
 
 }	// namespace technicalmachine

source/clients/party.hpp

 namespace technicalmachine {
 
 class Party {
-	public:
-		typedef uint8_t value_type;
-		Party();
-		explicit Party(value_type initial);
-		void set_if_unknown (Party new_party);
-		Party other() const;
-		value_type value() const;
-		friend bool operator==(Party lhs, Party rhs);
-	private:
-		value_type party;
+public:
+	typedef uint8_t value_type;
+	Party();
+	explicit Party(value_type initial);
+	void set_if_unknown (Party new_party);
+	Party other() const;
+	value_type value() const;
+	friend bool operator==(Party lhs, Party rhs);
+private:
+	value_type party;
 };
 
 bool operator!=(Party lhs, Party rhs);

source/clients/pokemon_lab/battle.hpp

 class Client;
 
 class Battle : public ::technicalmachine::Battle {
-	public:
-		template<typename ... Args>
-		Battle(Args &&... args):
-			::technicalmachine::Battle::Battle(std::forward<Args>(args)...) {
-		}
-		void handle_print (uint8_t category, uint16_t message_id, std::vector <std::string> const & arguments);
-		void update_active_print (std::vector <std::string> const & arguments);
-		void handle_set_move (uint8_t pokemon, uint8_t move_slot, int16_t new_move, uint8_t pp, uint8_t max_pp);
+public:
+	template<typename ... Args>
+	Battle(Args &&... args):
+		::technicalmachine::Battle::Battle(std::forward<Args>(args)...) {
+	}
+	void handle_print (uint8_t category, uint16_t message_id, std::vector <std::string> const & arguments);
+	void update_active_print (std::vector <std::string> const & arguments);
+	void handle_set_move (uint8_t pokemon, uint8_t move_slot, int16_t new_move, uint8_t pp, uint8_t max_pp);
 };
 
 }	// namespace pl

source/clients/pokemon_lab/battle_settings.hpp

 namespace pl {
 
 class BattleSettings : public ::technicalmachine::BattleSettings {
-	public:
-		BattleSettings(uint8_t battle_generation, uint32_t battle_active_party_size, uint32_t battle_max_team_length);
-		bool are_acceptable () const;
-	private:
-		uint32_t active_party_size;
-		uint32_t max_team_length;
-		uint8_t generation;
+public:
+	BattleSettings(uint8_t battle_generation, uint32_t battle_active_party_size, uint32_t battle_max_team_length);
+	bool are_acceptable () const;
+private:
+	uint32_t active_party_size;
+	uint32_t max_team_length;
+	uint8_t generation;
 };
 
 }	// namespace pl

source/clients/pokemon_lab/client.cpp

 }
 
 class Channel {
-	public:
-		std::string name;
-		uint8_t type;
-		std::string topic;
-		uint32_t population;
-		explicit Channel (InMessage & msg):
-			name (msg.read_string()),
-			type (msg.read_byte()),
-			topic (msg.read_string()),
-			population (msg.read_int()) {
-		}
+public:
+	std::string name;
+	uint8_t type;
+	std::string topic;
+	uint32_t population;
+	explicit Channel (InMessage & msg):
+		name (msg.read_string()),
+		type (msg.read_byte()),
+		topic (msg.read_string()),
+		population (msg.read_int()) {
+	}
 };
 
 class Metagame {
-	public:
-		uint8_t index;
-		std::string name;
-		std::string id;
-		std::string description;
-		uint8_t party_size;
-		uint8_t max_team_length;
+public:
+	uint8_t index;
+	std::string name;
+	std::string id;
+	std::string description;
+	uint8_t party_size;
+	uint8_t max_team_length;
 
-		std::vector <uint16_t> bans;
-		std::vector <std::string> clauses;
+	std::vector <uint16_t> bans;
+	std::vector <std::string> clauses;
 
-		bool timing;
-		uint16_t pool_length;
-		uint8_t periods;
-		uint16_t period_length;
-	private:
-		void load_bans (InMessage & msg) {
-			uint16_t ban_list_count = msg.read_short ();
-			for (uint16_t n = 0; n != ban_list_count; ++n) {
-				uint16_t species_id = msg.read_short ();
-				bans.emplace_back(species_id);
-			}
+	bool timing;
+	uint16_t pool_length;
+	uint8_t periods;
+	uint16_t period_length;
+private:
+	void load_bans (InMessage & msg) {
+		uint16_t ban_list_count = msg.read_short ();
+		for (uint16_t n = 0; n != ban_list_count; ++n) {
+			uint16_t species_id = msg.read_short ();
+			bans.emplace_back(species_id);
 		}
-		void load_clauses (InMessage & msg) {
-			uint16_t clause_count = msg.read_short ();
-			for (uint16_t b = 0; b != clause_count; ++b) {
-				std::string clause_name = msg.read_string ();
-				clauses.emplace_back(clause_name);
-			}
+	}
+	void load_clauses (InMessage & msg) {
+		uint16_t clause_count = msg.read_short ();
+		for (uint16_t b = 0; b != clause_count; ++b) {
+			std::string clause_name = msg.read_string ();
+			clauses.emplace_back(clause_name);
 		}
-		void load_battle_timer (InMessage & msg) {
-			timing = msg.read_byte ();
-			if (timing) {
-				pool_length = msg.read_short ();
-				periods = msg.read_byte ();
-				period_length = msg.read_short ();
-			}
+	}
+	void load_battle_timer (InMessage & msg) {
+		timing = msg.read_byte ();
+		if (timing) {
+			pool_length = msg.read_short ();
+			periods = msg.read_byte ();
+			period_length = msg.read_short ();
 		}
-	public:
-		explicit Metagame (InMessage & msg):
-			index (msg.read_byte ()),
-			name (msg.read_string ()),
-			id (msg.read_string ()),
-			description (msg.read_string ()),
-			party_size (msg.read_byte ()),
-			max_team_length (msg.read_byte ()),
-			pool_length (0xFFFF),
-			periods (0xFF),
-			period_length (0xFFFF) {
-			load_bans (msg);
-			load_clauses (msg);
-			load_battle_timer (msg);
-		}
+	}
+public:
+	explicit Metagame (InMessage & msg):
+		index (msg.read_byte ()),
+		name (msg.read_string ()),
+		id (msg.read_string ()),
+		description (msg.read_string ()),
+		party_size (msg.read_byte ()),
+		max_team_length (msg.read_byte ()),
+		pool_length (0xFFFF),
+		periods (0xFF),
+		period_length (0xFFFF) {
+		load_bans (msg);
+		load_clauses (msg);
+		load_battle_timer (msg);
+	}
 };
 
 void Client::handle_message (InMessage::Message code, InMessage & msg) {

source/clients/pokemon_lab/client.hpp

 class Metagame;
 
 class Client : public network::Client {
-	public:
-		explicit Client (unsigned set_depth);
-		void run ();
-		void handle_message (InMessage::Message code, InMessage & msg);
-		void send_channel_message(std::string const & channel, std::string const & message);
-		void send_channel_message (uint32_t channel_id, std::string const & message);
-	private:
-		void reset_timer(long timer_length);
-		void request_authentication ();
-		void send_keep_alive_message ();
-		void handle_welcome_message (uint32_t version, std::string const & server, std::string const & message) const;
-		void handle_password_challenge (InMessage & msg);
-		enum SecretStyle {
-			NONE = 0,
-			MD5 = 1,		// This secret style is never actually used.
-			VBULLETIN = 2
-		};
-		std::string get_challenge_response (std::string const & challenge, SecretStyle secret_style, std::string const & salt);
-		std::string get_shared_secret (SecretStyle secret_style, std::string const & salt);
-		void handle_registry_response (uint8_t code, std::string const & details);
-		void join_channel (std::string const & channel);
-		void part_channel (std::string const & channel);
-		void handle_channel_info (uint32_t channel_id, uint8_t info, std::string const & channel_name, std::string const & topic, uint32_t channel_flags, std::vector <std::pair <std::string, uint32_t> > const & users);
-		void handle_channel_join_part (uint32_t channel_id, std::string const & user, bool joining);
-		void handle_channel_status (uint32_t channel_id, std::string const & invoker, std::string const & user, uint32_t flags);
-		void handle_channel_list (std::vector <Channel> const & channel_list);
-		void send_battle_challenge (std::string const & opponent);
-		void handle_finalize_challenge (std::string const & user, bool accepted, bool challenger);
-		void handle_metagame_list (std::vector <Metagame> const & metagames);
-		void handle_invalid_team(std::vector<int16_t> const & violations) const;
-		void handle_error_message (uint8_t code, std::string const & details) const;
-		void send_private_message (std::string const & user, std::string const & message);
-		Result get_result (uint32_t battle_id, uint16_t winner);
+public:
+	explicit Client (unsigned set_depth);
+	void run ();
+	void handle_message (InMessage::Message code, InMessage & msg);
+	void send_channel_message(std::string const & channel, std::string const & message);
+	void send_channel_message (uint32_t channel_id, std::string const & message);
+private:
+	void reset_timer(long timer_length);
+	void request_authentication ();
+	void send_keep_alive_message ();
+	void handle_welcome_message (uint32_t version, std::string const & server, std::string const & message) const;
+	void handle_password_challenge (InMessage & msg);
+	enum SecretStyle {
+		NONE = 0,
+		MD5 = 1,		// This secret style is never actually used.
+		VBULLETIN = 2
+	};
+	std::string get_challenge_response (std::string const & challenge, SecretStyle secret_style, std::string const & salt);
+	std::string get_shared_secret (SecretStyle secret_style, std::string const & salt);
+	void handle_registry_response (uint8_t code, std::string const & details);
+	void join_channel (std::string const & channel);
+	void part_channel (std::string const & channel);
+	void handle_channel_info (uint32_t channel_id, uint8_t info, std::string const & channel_name, std::string const & topic, uint32_t channel_flags, std::vector <std::pair <std::string, uint32_t> > const & users);
+	void handle_channel_join_part (uint32_t channel_id, std::string const & user, bool joining);
+	void handle_channel_status (uint32_t channel_id, std::string const & invoker, std::string const & user, uint32_t flags);
+	void handle_channel_list (std::vector <Channel> const & channel_list);
+	void send_battle_challenge (std::string const & opponent);
+	void handle_finalize_challenge (std::string const & user, bool accepted, bool challenger);
+	void handle_metagame_list (std::vector <Metagame> const & metagames);
+	void handle_invalid_team(std::vector<int16_t> const & violations) const;
+	void handle_error_message (uint8_t code, std::string const & details) const;
+	void send_private_message (std::string const & user, std::string const & message);
+	Result get_result (uint32_t battle_id, uint16_t winner);
 
-		std::unique_ptr<boost::asio::deadline_timer> timer;
-		std::map <std::string, uint32_t> channel_to_id;
+	std::unique_ptr<boost::asio::deadline_timer> timer;
+	std::map <std::string, uint32_t> channel_to_id;
 };
 
 } // namespace pl

source/clients/pokemon_lab/id.hpp

 class IDType;
 template<>
 class IDType<Species> {
-	public:
-		typedef uint16_t type;
+public:
+	typedef uint16_t type;
 };
 template<>
 class IDType<Moves> {
-	public:
-		typedef uint16_t type;
+public:
+	typedef uint16_t type;
 };
 template<>
 class IDType<Gender::Genders> {
-	public:
-		typedef uint8_t type;
+public:
+	typedef uint8_t type;
 };
 
 template<typename T>
 class ID {
-	public:
-		typedef typename IDType<T>::type underlying_type;
-		constexpr explicit ID(underlying_type const id):
-			m_value(id) {
-		}
-		constexpr underlying_type value() const {
-			return m_value;
-		}
-	private:
-		underlying_type m_value;
+public:
+	typedef typename IDType<T>::type underlying_type;
+	constexpr explicit ID(underlying_type const id):
+		m_value(id) {
+	}
+	constexpr underlying_type value() const {
+		return m_value;
+	}
+private:
+	underlying_type m_value;
 };
 
 

source/clients/pokemon_lab/inmessage.hpp

 
 
 class InMessage : public network::InMessage::InMessage {
-	public:
-		InMessage ();
-		std::string read_string ();
-		void read_body (boost::asio::ip::tcp::socket & socket, network::Client * client);
+public:
+	InMessage ();
+	std::string read_string ();
+	void read_body (boost::asio::ip::tcp::socket & socket, network::Client * client);
 
-		enum Message {
-			WELCOME_MESSAGE = 0,
-			PASSWORD_CHALLENGE = 1,
-			REGISTRY_RESPONSE = 2,
-			SERVER_INFO = 3,
-			CHANNEL_INFO = 4,
-			CHANNEL_JOIN_PART = 5,
-			CHANNEL_STATUS = 6,
-			CHANNEL_LIST = 7,
-			CHANNEL_MESSAGE = 8,
-			INCOMING_CHALLENGE = 9,
-			FINALIZE_CHALLENGE = 10,
-			CHALLENGE_WITHDRAWN = 11,
-			BATTLE_BEGIN = 12,
-			REQUEST_ACTION = 13,
-			BATTLE_POKEMON = 14,
-			BATTLE_PRINT = 15,
-			BATTLE_END = 16,	// "BATTLE_VICTORY"
-			BATTLE_USE_MOVE = 17,
-			BATTLE_WITHDRAW = 18,
-			BATTLE_SEND_OUT = 19,
-			BATTLE_HEALTH_CHANGE = 20,
-			BATTLE_SET_PP = 21,
-			BATTLE_FAINTED = 22,
-			BATTLE_BEGIN_TURN = 23,
-			SPECTATOR_BEGIN = 24,
-			BATTLE_SET_MOVE = 25,
-			METAGAME_LIST = 26,
-			KICK_BAN_MESSAGE = 27,
-			USER_DETAILS = 28,
-			USER_MESSAGE = 29,
-			BATTLE_STATUS_CHANGE = 30,
-			CLAUSE_LIST = 31,
-			INVALID_TEAM = 32,
-			ERROR_MESSAGE = 33,
-			PRIVATE_MESSAGE = 34,
-			IMPORTANT_MESSAGE = 35
-		};
-		enum PrintCategory {
-			TYPES = 0,
-			NATURES = 1,
-			STATS = 2,
-			STATS_LONG = 3,
-			BATTLE_MESSAGES = 4,
-			STATUS_EFFECTS_STAT_LEVEL = 5,
-			STATUS_EFFECTS_BURN = 6,
-			STATUS_EFFECTS_CONFUSION = 7,
-			STATUS_EFFECTS_FREEZE = 8,
-			STATUS_EFFECTS_PARALYSIS = 9,
-			STATUS_EFFECTS_POISON = 10,
-			STATUS_EFFECTS_SLEEP = 11,
-			STATUS_EFFECTS_FLINCH = 12,
-			STATUS_EFFECTS_STOCKPILE = 13,
-			STATUS_EFFECTS_LEECH_SEED = 14,
-			STATUS_EFFECTS_ATTRACT = 15,
-			STATUS_EFFECTS_SPIKES = 16,
-			WEATHER_FOG = 17,
-			WEATHER_HAIL = 18,
-			WEATHER_RAIN = 19,
-			WEATHER_SANDSTORM = 20,
-			WEATHER_SUN = 21,
-			BATTLE_MESSAGES_UNIQUE = 22,
-			BATTLE_MESSAGES_CHARGE = 23,
-			ABILITIES = 24,
-			ABILITY_MESSAGES = 25,
-			ITEM_MESSAGES = 26,
-			CLIENT_MESSAGES = 27
-		};
-	private:
-		size_t header_size() const { return 5; }
+	enum Message {
+		WELCOME_MESSAGE = 0,
+		PASSWORD_CHALLENGE = 1,
+		REGISTRY_RESPONSE = 2,
+		SERVER_INFO = 3,
+		CHANNEL_INFO = 4,
+		CHANNEL_JOIN_PART = 5,
+		CHANNEL_STATUS = 6,
+		CHANNEL_LIST = 7,
+		CHANNEL_MESSAGE = 8,
+		INCOMING_CHALLENGE = 9,
+		FINALIZE_CHALLENGE = 10,
+		CHALLENGE_WITHDRAWN = 11,
+		BATTLE_BEGIN = 12,
+		REQUEST_ACTION = 13,
+		BATTLE_POKEMON = 14,
+		BATTLE_PRINT = 15,
+		BATTLE_END = 16,	// "BATTLE_VICTORY"
+		BATTLE_USE_MOVE = 17,
+		BATTLE_WITHDRAW = 18,
+		BATTLE_SEND_OUT = 19,
+		BATTLE_HEALTH_CHANGE = 20,
+		BATTLE_SET_PP = 21,
+		BATTLE_FAINTED = 22,
+		BATTLE_BEGIN_TURN = 23,
+		SPECTATOR_BEGIN = 24,
+		BATTLE_SET_MOVE = 25,
+		METAGAME_LIST = 26,
+		KICK_BAN_MESSAGE = 27,
+		USER_DETAILS = 28,
+		USER_MESSAGE = 29,
+		BATTLE_STATUS_CHANGE = 30,
+		CLAUSE_LIST = 31,
+		INVALID_TEAM = 32,
+		ERROR_MESSAGE = 33,
+		PRIVATE_MESSAGE = 34,
+		IMPORTANT_MESSAGE = 35
+	};
+	enum PrintCategory {
+		TYPES = 0,
+		NATURES = 1,
+		STATS = 2,
+		STATS_LONG = 3,
+		BATTLE_MESSAGES = 4,
+		STATUS_EFFECTS_STAT_LEVEL = 5,
+		STATUS_EFFECTS_BURN = 6,
+		STATUS_EFFECTS_CONFUSION = 7,
+		STATUS_EFFECTS_FREEZE = 8,
+		STATUS_EFFECTS_PARALYSIS = 9,
+		STATUS_EFFECTS_POISON = 10,
+		STATUS_EFFECTS_SLEEP = 11,
+		STATUS_EFFECTS_FLINCH = 12,
+		STATUS_EFFECTS_STOCKPILE = 13,
+		STATUS_EFFECTS_LEECH_SEED = 14,
+		STATUS_EFFECTS_ATTRACT = 15,
+		STATUS_EFFECTS_SPIKES = 16,
+		WEATHER_FOG = 17,
+		WEATHER_HAIL = 18,
+		WEATHER_RAIN = 19,
+		WEATHER_SANDSTORM = 20,
+		WEATHER_SUN = 21,
+		BATTLE_MESSAGES_UNIQUE = 22,
+		BATTLE_MESSAGES_CHARGE = 23,
+		ABILITIES = 24,
+		ABILITY_MESSAGES = 25,
+		ITEM_MESSAGES = 26,
+		CLIENT_MESSAGES = 27
+	};
+private:
+	size_t header_size() const { return 5; }
 };
 
 }	// namespace pl

source/clients/pokemon_lab/outmessage.hpp

 namespace pl {
 
 class OutMessage : public network::OutMessage {
-	public:
-		explicit OutMessage (uint8_t code);
-		void write_string (std::string const & string);
-		void write_team (Team const & team, std::string const & = std::string());
-		void write_pokemon (Pokemon const & pokemon);
-		void write_move (uint32_t battle_id, uint8_t move_index, uint8_t target = 1);
-		void write_switch (uint32_t battle_id, uint8_t slot);
-		void write_challenge (std::string const & opponent, uint8_t generation, uint32_t party_size, uint32_t team_length, uint32_t metagame = 0, std::vector <uint8_t> const & clauses = std::vector <uint8_t> (), bool timing = true, uint32_t pool = 30, uint8_t periods = 3, uint32_t period_length = 30);
-		void finalize();
-		enum Message {
-			REQUEST_CHALLENGE = 0,
-			CHALLENGE_RESPONSE = 1,
-			REGISTER_ACCOUNT = 2,
-			JOIN_CHANNEL = 3,
-			CHANNEL_MESSAGE = 4,
-			CHANNEL_MODE = 5,
-			OUTGOING_CHALLENGE = 6,
-			RESOLVE_CHALLENGE = 7,
-			CHALLENGE_TEAM = 8,
-			WITHDRAW_CHALLENGE = 9,
-			BATTLE_ACTION = 10,
-			PART_CHANNEL = 11,
-			REQUEST_CHANNEL_LIST = 12,
-			QUEUE_TEAM = 13,
-			BAN_MESSAGE = 14,
-			USER_INFO_MESSAGE = 15,
-			USER_PERSONAL_MESSAGE = 16,
-			USER_MESSAGE_REQUEST = 17,
-			CLIENT_ACTIVITY = 18,
-			CANCEL_QUEUE = 19,
-			CANCEL_BATTLE_ACTION = 20,
-			PRIVATE_MESSAGE = 21,
-			IMPORTANT_MESSAGE = 22
-		};
+public:
+	explicit OutMessage (uint8_t code);
+	void write_string (std::string const & string);
+	void write_team (Team const & team, std::string const & = std::string());
+	void write_pokemon (Pokemon const & pokemon);
+	void write_move (uint32_t battle_id, uint8_t move_index, uint8_t target = 1);
+	void write_switch (uint32_t battle_id, uint8_t slot);
+	void write_challenge (std::string const & opponent, uint8_t generation, uint32_t party_size, uint32_t team_length, uint32_t metagame = 0, std::vector <uint8_t> const & clauses = std::vector <uint8_t> (), bool timing = true, uint32_t pool = 30, uint8_t periods = 3, uint32_t period_length = 30);
+	void finalize();
+	enum Message {
+		REQUEST_CHALLENGE = 0,
+		CHALLENGE_RESPONSE = 1,
+		REGISTER_ACCOUNT = 2,
+		JOIN_CHANNEL = 3,
+		CHANNEL_MESSAGE = 4,
+		CHANNEL_MODE = 5,
+		OUTGOING_CHALLENGE = 6,
+		RESOLVE_CHALLENGE = 7,
+		CHALLENGE_TEAM = 8,
+		WITHDRAW_CHALLENGE = 9,
+		BATTLE_ACTION = 10,
+		PART_CHANNEL = 11,
+		REQUEST_CHANNEL_LIST = 12,
+		QUEUE_TEAM = 13,
+		BAN_MESSAGE = 14,
+		USER_INFO_MESSAGE = 15,
+		USER_PERSONAL_MESSAGE = 16,
+		USER_MESSAGE_REQUEST = 17,
+		CLIENT_ACTIVITY = 18,
+		CANCEL_QUEUE = 19,
+		CANCEL_BATTLE_ACTION = 20,
+		PRIVATE_MESSAGE = 21,
+		IMPORTANT_MESSAGE = 22
+	};
 };
 
 } // namespace pl

source/clients/pokemon_online/battle.cpp

 namespace {
 
 class Todo {
-	public:
-		explicit Todo (InMessage & in_msg, std::string const & str):
-			msg (in_msg) {
-			std::cerr << str + '\n';
-		}
-		explicit Todo (InMessage & in_msg):
-			msg (in_msg) {
-		}
-		~Todo() {
-			while (msg.index != msg.buffer.size ())
-				std::cerr << '\t' << static_cast<int> (msg.read_byte()) << '\n';
-		}
-	private:
-		InMessage & msg;
+public:
+	explicit Todo (InMessage & in_msg, std::string const & str):
+		msg (in_msg) {
+		std::cerr << str + '\n';
+	}
+	explicit Todo (InMessage & in_msg):
+		msg (in_msg) {
+	}
+	~Todo() {
+		while (msg.index != msg.buffer.size ())
+			std::cerr << '\t' << static_cast<int> (msg.read_byte()) << '\n';
+	}
+private:
+	InMessage & msg;
 };
 
 std::array<int8_t, 7> parse_boosts(InMessage & msg);

source/clients/pokemon_online/battle.hpp

 class InMessage;
 
 class Battle : public ::technicalmachine::Battle {
-	public:
-		template<typename ... Args>
-		Battle(std::string const & foe_name, std::random_device::result_type seed, unsigned const battle_depth, bool const challenger, Args && ... args):
-			::technicalmachine::Battle::Battle(foe_name, seed, battle_depth, std::forward<Args>(args)...),
-			action (OutMessage::BATTLE_MESSAGE)
-			{
-			set_party_if_unknown(Party(challenger ? 0 : 1));
-		}
-		void handle_message (Client & client, uint32_t battle_id, uint8_t command, Party party, InMessage & msg);
-		static constexpr unsigned pokemon_per_team() {
-			return 6;
-		}
-		static constexpr unsigned moves_per_pokemon() {
-			return 4;
-		}
-	private:
-		void parse_begin_turn (InMessage & msg) const;
-		void parse_send_out (InMessage & msg, Party party);
-		void parse_use_attack (InMessage & msg, Party party);
-		void parse_straight_damage (InMessage & msg);
-		void parse_hp_change (InMessage & msg, Party party);
-		void parse_pp_change (InMessage & msg);
-		void parse_effectiveness (InMessage & msg);
-		void parse_number_of_hits (InMessage & msg);
-		void parse_stat_change (InMessage & msg);
-		void parse_status_message (InMessage & msg);
-		void parse_status_change (InMessage & msg);
-		void parse_abs_status_change (InMessage & msg);
-		void parse_already_statused (InMessage & msg);
-		void parse_recoil (InMessage & msg);
-		void parse_weather_message (InMessage & msg);
-		void parse_ability_message (InMessage & msg, Party party);
-		void parse_item_message (InMessage & msg, Party party);
-		void parse_move_message (InMessage & msg);
-		void parse_substitute (InMessage & msg);
-		void parse_dynamic_info (InMessage & msg);
-		void parse_dynamic_stats (InMessage & msg);
-		void parse_spectating (InMessage & msg);
-		void parse_temporary_pokemon_change (InMessage & msg);
-		void parse_clock_start (InMessage & msg);
-		void parse_clock_stop (InMessage & msg);
-		void handle_rated (Client & client, InMessage & msg);
-		void parse_tier_section (InMessage & msg);
-		void parse_battle_chat (Client const & client, InMessage & msg);
-		void parse_spectator_chat (Client const & client, InMessage & msg, uint32_t battle_id);
-		void parse_point_estimate (InMessage & msg);
-		void parse_offer_choice (Client & client, InMessage & msg, uint32_t battle_id);
-		void handle_make_your_choice (Client & client);
-		void handle_cancel_move ();
-		void parse_rearrange_team (InMessage & msg);
-		void parse_spot_shifts (InMessage & msg);
-		void parse_battle_end (InMessage & msg);
-		uint16_t max_damage_precision () const;
-		Party last_attacker;
-		OutMessage action;
+public:
+	template<typename ... Args>
+	Battle(std::string const & foe_name, std::random_device::result_type seed, unsigned const battle_depth, bool const challenger, Args && ... args):
+		::technicalmachine::Battle::Battle(foe_name, seed, battle_depth, std::forward<Args>(args)...),
+		action (OutMessage::BATTLE_MESSAGE)
+		{
+		set_party_if_unknown(Party(challenger ? 0 : 1));
+	}
+	void handle_message (Client & client, uint32_t battle_id, uint8_t command, Party party, InMessage & msg);
+	static constexpr unsigned pokemon_per_team() {
+		return 6;
+	}
+	static constexpr unsigned moves_per_pokemon() {
+		return 4;
+	}
+private:
+	void parse_begin_turn (InMessage & msg) const;
+	void parse_send_out (InMessage & msg, Party party);
+	void parse_use_attack (InMessage & msg, Party party);
+	void parse_straight_damage (InMessage & msg);
+	void parse_hp_change (InMessage & msg, Party party);
+	void parse_pp_change (InMessage & msg);
+	void parse_effectiveness (InMessage & msg);
+	void parse_number_of_hits (InMessage & msg);
+	void parse_stat_change (InMessage & msg);
+	void parse_status_message (InMessage & msg);
+	void parse_status_change (InMessage & msg);
+	void parse_abs_status_change (InMessage & msg);
+	void parse_already_statused (InMessage & msg);
+	void parse_recoil (InMessage & msg);
+	void parse_weather_message (InMessage & msg);
+	void parse_ability_message (InMessage & msg, Party party);
+	void parse_item_message (InMessage & msg, Party party);
+	void parse_move_message (InMessage & msg);
+	void parse_substitute (InMessage & msg);
+	void parse_dynamic_info (InMessage & msg);
+	void parse_dynamic_stats (InMessage & msg);
+	void parse_spectating (InMessage & msg);
+	void parse_temporary_pokemon_change (InMessage & msg);
+	void parse_clock_start (InMessage & msg);
+	void parse_clock_stop (InMessage & msg);
+	void handle_rated (Client & client, InMessage & msg);
+	void parse_tier_section (InMessage & msg);
+	void parse_battle_chat (Client const & client, InMessage & msg);
+	void parse_spectator_chat (Client const & client, InMessage & msg, uint32_t battle_id);
+	void parse_point_estimate (InMessage & msg);
+	void parse_offer_choice (Client & client, InMessage & msg, uint32_t battle_id);
+	void handle_make_your_choice (Client & client);
+	void handle_cancel_move ();
+	void parse_rearrange_team (InMessage & msg);
+	void parse_spot_shifts (InMessage & msg);
+	void parse_battle_end (InMessage & msg);
+	uint16_t max_damage_precision () const;
+	Party last_attacker;
+	OutMessage action;
 };
 
 }	// namespace po

source/clients/pokemon_online/battle_settings.hpp

 class InMessage;
 
 class BattleSettings : public ::technicalmachine::BattleSettings {
-	public:
-		enum Clauses : uint32_t {
-			SLEEP_CLAUSE = 1 << 0,
-			FREEZE_CLAUSE = 1 << 1,
-			DISALLOW_SPECTATORS = 1 << 2,
-			ITEM_CLAUSE = 1 << 3,
-			CHALLENGE_CUP = 1 << 4,
-			NO_TIME_OUT = 1 << 5,
-			SPECIES_CLAUSE = 1 << 6,
-			REARRANGE_TEAMS = 1 << 7,
-			SELF_KO_CLAUSE = 1 << 8
-		};
-		enum Mode {
-			SINGLES = 0,
-			DOUBLES = 1,
-			TRIPLES = 2,
-			ROTATION = 3
-		};
-		uint32_t const clauses;
-		Mode const mode;
-		BattleSettings (uint32_t battle_clauses, uint8_t battle_mode);
-		BattleSettings (std::vector <uint32_t> const & battle_clauses, uint8_t battle_mode);
-	private:
-		bool active (Clauses const check) const;
-	public:
-		bool are_acceptable () const;
+public:
+	enum Clauses : uint32_t {
+		SLEEP_CLAUSE = 1 << 0,
+		FREEZE_CLAUSE = 1 << 1,
+		DISALLOW_SPECTATORS = 1 << 2,
+		ITEM_CLAUSE = 1 << 3,
+		CHALLENGE_CUP = 1 << 4,
+		NO_TIME_OUT = 1 << 5,
+		SPECIES_CLAUSE = 1 << 6,
+		REARRANGE_TEAMS = 1 << 7,
+		SELF_KO_CLAUSE = 1 << 8
+	};
+	enum Mode {
+		SINGLES = 0,
+		DOUBLES = 1,
+		TRIPLES = 2,
+		ROTATION = 3
+	};
+	BattleSettings (uint32_t battle_clauses, uint8_t battle_mode);
+	BattleSettings (std::vector <uint32_t> const & battle_clauses, uint8_t battle_mode);
+	bool are_acceptable () const;
+	uint32_t const clauses;
+	Mode const mode;
+private:
+	bool active (Clauses const check) const;
 };
 
 class BattleConfiguration {
-	public:
-		BattleConfiguration (InMessage & msg);
-	private:
-		uint8_t const generation;
-		uint8_t const mode;
-		uint32_t const id1;
-		uint32_t const id2;
-		uint32_t const clauses;
-		BattleSettings const settings;
+public:
+	BattleConfiguration (InMessage & msg);
+private:
+	uint8_t const generation;
+	uint8_t const mode;
+	uint32_t const id1;
+	uint32_t const id2;
+	uint32_t const clauses;
+	BattleSettings const settings;
 };
 
 }	// namespace po

source/clients/pokemon_online/client.cpp

 
 namespace {
 class BattlePokemon {
-	public:
-		std::pair <uint16_t, uint8_t> id;
-		std::string nickname;
-		uint16_t max_hp;
-		uint16_t hp;
-		Gender gender;
-		bool shiny;
-		uint8_t level;
-		Item item;
-		Ability ability;
-		uint8_t happiness;
-		std::vector<Moves> moves;
-		explicit BattlePokemon (InMessage & msg):
-			id (msg.read_short (), msg.read_byte ()),
-			nickname (msg.read_string ()),
-			max_hp (msg.read_short ()),
-			hp (msg.read_short ()),
-			gender (id_to_gender (msg.read_byte ())),
-			shiny (msg.read_byte ()),
-			level (msg.read_byte ()),
-			item (id_to_item (msg.read_short ())),
-			ability (id_to_ability (msg.read_short ())),
-			happiness (msg.read_byte ())
-			{
-			for (unsigned n = 0; n != 5; ++n) {
-				// Something to do with stats. Probably boosts.
-				uint16_t const st = msg.read_short ();
-			}
-			for (unsigned n = 0; n != 4; ++n) {
-				moves.emplace_back(id_to_move(msg.read_short()));
-				uint8_t const pp = msg.read_byte ();
-				uint8_t const total_pp = msg.read_byte ();
-			}
-			for (unsigned n = 0; n != 6; ++n) {
-				// PO uses a QList of int, so hopefully their int is always 32-bit.
-				uint32_t const ev = msg.read_int ();
-			}
-			for (unsigned n = 0; n != 6; ++n) {
-				uint32_t const dv = msg.read_int ();
-			}
+public:
+	std::pair <uint16_t, uint8_t> id;
+	std::string nickname;
+	uint16_t max_hp;
+	uint16_t hp;
+	Gender gender;
+	bool shiny;
+	uint8_t level;
+	Item item;
+	Ability ability;
+	uint8_t happiness;
+	std::vector<Moves> moves;
+	explicit BattlePokemon (InMessage & msg):
+		id (msg.read_short (), msg.read_byte ()),
+		nickname (msg.read_string ()),
+		max_hp (msg.read_short ()),
+		hp (msg.read_short ()),
+		gender (id_to_gender (msg.read_byte ())),
+		shiny (msg.read_byte ()),
+		level (msg.read_byte ()),
+		item (id_to_item (msg.read_short ())),
+		ability (id_to_ability (msg.read_short ())),
+		happiness (msg.read_byte ())
+		{
+		for (unsigned n = 0; n != 5; ++n) {
+			// Something to do with stats. Probably boosts.
+			uint16_t const st = msg.read_short ();
 		}
+		for (unsigned n = 0; n != 4; ++n) {
+			moves.emplace_back(id_to_move(msg.read_short()));
+			uint8_t const pp = msg.read_byte ();
+			uint8_t const total_pp = msg.read_byte ();
+		}
+		for (unsigned n = 0; n != 6; ++n) {
+			// PO uses a QList of int, so hopefully their int is always 32-bit.
+			uint32_t const ev = msg.read_int ();
+		}
+		for (unsigned n = 0; n != 6; ++n) {
+			uint32_t const dv = msg.read_int ();
+		}
+	}
 };
 
 class BattleTeam {
-	public:
-		std::vector <BattlePokemon> pokemon;
-		explicit BattleTeam (InMessage & msg) {
-			for (unsigned n = 0; n != 6; ++n) {
-				pokemon.emplace_back(msg);
-			}
+public:
+	std::vector <BattlePokemon> pokemon;
+	explicit BattleTeam (InMessage & msg) {
+		for (unsigned n = 0; n != 6; ++n) {
+			pokemon.emplace_back(msg);
 		}
+	}
 };
 }	// unnamed namespace