This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFBullCowGame.h
74 lines (60 loc) · 1.74 KB
/
FBullCowGame.h
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
#pragma once
#include <string>
using FString = std::string;
using int32 = int;
// TODO finish to package everything to distribute and asn for playtesting
// TODO find an online terminal to make things easier for people to play this (this might not be that easy...)
// TODO find the sweet spot to these word lengths -> play test (post in gamedev; tell some friends; search some online terminal)
// TODO posts in gamedev forum:
// -lec. 52 (range-based for loop) : why does this implementation work? doesn't the computer
// have too look up all key values until it finds a value or reaches the end of the map?
// -lec ? : ascii art that i used
// -lec ? : ask for playtesting; also help with playtesting
enum class EDifficultyStatus {
OK,
Not_Number,
Out_of_Bounds,
};
struct FWordLengthRange
{
int32 MyWLMax = 0;
int32 MyWLMin = 0;
};
enum class EGuessStatus
{
OK,
Not_Isogram,
Forbidden_Characters,
Wrong_Size
};
struct FBullCowCount
{
int32 MyBulls = 0;
int32 MyCows = 0;
};
class FBullCowGame
{
public:
FBullCowGame(); // constructor
int32 GetCurrentTry() const;
int32 GetWordLength() const;
int32 GetMaxTries() const;
FWordLengthRange GetWordLengthRange() const;
EDifficultyStatus CheckDifficultyValidity(FString) const;
EGuessStatus CheckGuessValidity(FString) const;
bool IsIsogram(FString) const;
bool IsLowercase(FString)const;
bool HasForbidChar(FString) const;
bool IsGameWon() const;
void Constructor();
void Set(FString);
void IncreaseCurrentTry();
FBullCowCount CountBullsCows(FString);
private:
// initializations in constructor
FString MyHiddenWord;
int32 MyCurrentTry;
FString MyGuess;
bool MyGuessValidity;
FBullCowCount MyBCCount;
};