-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.cpp
More file actions
81 lines (74 loc) · 1.94 KB
/
test.cpp
File metadata and controls
81 lines (74 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#if __has_include("srell.hpp")
#include "srell.hpp"
#define USE_POWERFUL_REGEX 1
#pragma message("SUCCESS: Compiling with powerful SRELL regex engine. Lookbehinds will work.")
#else
#include <regex>
#define USE_POWERFUL_REGEX 0
#pragma message("WARNING: srell.hpp not found. Falling back to limited std::regex. Lookbehinds will NOT work.")
#endif
#include <algorithm>
#include <any>
#include <cstdint>
#include <iostream>
#include <optional>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
// Print function for const char*
void print(const char* value) {
std::cout << std::string(value) << std::endl;
}
// Handle signed 8-bit integers
void print(int8_t value) {
std::cout << static_cast<int>(value) << std::endl;
}
// Handle unsigned 8-bit integers
void print(uint8_t value) {
std::cout << static_cast<unsigned int>(value) << std::endl;
}
// Generic print function fallback
template <typename T>
void print(const T& value) {
std::cout << value << std::endl;
}
// Convert various types to std::string
std::string STR(int value) {
return std::to_string(value);
}
// Convert various types to std::string
std::string STR(long long value) {
return std::to_string(value);
}
std::string STR(float value) {
return std::to_string(value);
}
std::string STR(double value) {
return std::to_string(value);
}
std::string STR(size_t value) {
return std::to_string(value);
}
std::string STR(bool value) {
return value ? "1" : "0";
}
std::string STR(const char* value) {
return std::string(value);
}
std::string STR(const std::string& value) {
return value;
}
int Player_health = 100;
int Player_mana = 50;
int hero_health = 100;
int hero_mana = 50;
int goblin_health = 100;
int goblin_mana = 50;
int main(int argc, char* argv[]) {
hero_health = 200;
goblin_health = 30;
print("Hero health: " + STR(hero_health));
print("Goblin health: " + STR(goblin_health));
return 0;
}