-
Notifications
You must be signed in to change notification settings - Fork 0
/
FBullCowGame.h
61 lines (49 loc) · 1.22 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
/*The game logic (no view or code or direct user interaction)*/
#pragma once
#include<string>
// to make the syntax unreal friendly
using FString = std::string;
using int32 = int;
// used to return 2 variables that can be passes into the other functions later on
// all values are initalised to zero
// refrence for struct (https://study.com/academy/lesson/how-to-use-structs-in-c-programming.html)
struct FBullCowCount
{
int32 Bulls = 0;
int32 Cows = 0;
};
/*
include class keyword in enumerations because otherwise
we can't make any other enumerations with the same word like OK
*/
enum class EGuessStatus
{
Invalid_Status,
OK,
Not_Isogram,
World_Length,
Not_Lowercase
};
class FBullCowGame {
public:
FBullCowGame(); // default constructor
void Reset();
int32 GetMaxTries() const;
int32 GetCurrentTry() const;
int32 GetHiddenWordLength() const;
bool IsGameWon() const;
EGuessStatus CheckGuessValidity(FString Guess);
/*
provide bulls and cows for counting bulls and cows,
and increading turn number
*/
FBullCowCount SubmitValidGuess(FString);
private:
int32 MyCurrentTry;
int32 MyMaxTries;
//bool IsIsogram;
FString MyHiddenWord;
bool bGameIsWon;
bool IsIsogram(FString);
bool IsLowerCase(FString);
};