-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUX.h
89 lines (75 loc) · 2.22 KB
/
UX.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// /////////////////////////////////////////////////////////
//
// File: clerdle/UX.h
// Author: Michael Foster
// Date: 2022.04.29
//
// This is the header file for UX.cpp.
// See that file for more information.
//
// /////////////////////////////////////////////////////////
#ifndef UX_H
#define UX_H
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include "color.h"
#include "Guess.h"
class UX
{
private:
static void splash(bool = false);
static std::string colorMap(Guess::charState);
static void printHistory(const std::vector<Guess> &, int, int = 0);
static std::string wonMsg();
static void streamSingleBar(std::stringstream &, int, int);
public:
static void welcome();
static void welcome(std::string);
static void printHelp();
static void printTestAnswer(std::string);
static std::string promptPlayerName();
static void printPlayerName(std::string);
static void printGameStart(int);
static void printRound(int, const std::vector<Guess> &, Guess, int = 0);
static std::string promptGuess(bool = false);
static void printLoss(std::string);
static bool promptReplay();
static void printHistogram(std::string, std::vector<int>);
static void errorCSVParse();
static void errorUserNotFound();
static void errorNoGenNumber();
static void errorFileUnavailable();
template <typename T>
static void print(T el) { std::cout << el << "\n"; }
template <typename T>
static void prints(T el) { std::cout << el << "\n"; }
template <typename T>
static void print1(T el) { std::cout << el << " "; };
template <typename T, typename... Next>
static void print(T, Next...);
template <typename T, typename... Next>
static void prints(T, Next...);
template <typename T, typename... Next>
static void print1(T, Next...);
};
template <typename T, typename... Next>
void UX::print(T el, Next... n)
{
std::cout << el << "\n";
print(n...);
}
template <typename T, typename... Next>
void UX::prints(T el, Next... n)
{
std::cout << el << " ";
prints(n...);
}
template <typename T, typename... Next>
void UX::print1(T el, Next... n)
{
std::cout << el << " ";
print1(n...);
}
#endif