A weird game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
turings-tarpit/game_engine.hpp

58 lines
829 B

#pragma once
#include <string>
#include <map>
#include <array>
#include <sstream>
using std::string;
class GameEngine {
std::map<string, int> damage_types{
{"error", 4},
{"warning", 1},
{"note", 0},
};
public:
int starting_hp = 0;
int hit_points = 0;
int hits_taken = 0;
int rounds = 0;
int streak = 0;
GameEngine(int hp);
int determine_damage(string &type);
void start_round();
void end_round();
bool hit(string &type);
bool is_dead();
void heal();
void reset();
};
class Brainfucker {
public:
size_t dp = 0;
size_t ip = 0;
std::stringstream out;
std::array<int, 100> data = {};
string code = {};
Brainfucker();
void run(int count);
void set_code(string &code);
void reset();
void jump_backward();
void jump_forward();
string to_string();
};