-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReadMe.txt
executable file
·204 lines (178 loc) · 4.47 KB
/
ReadMe.txt
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
Files:
Lab4.h - Lab 4 Header file
lab4.cpp - Lab 4 Source file
GameBase.h - Game Base Header file
GameBase.cpp - Game Base Sourcefile
GamePiece.h - Game Piece Header file
gamePiece.cpp - Game Piece Source file
nineAlmondsGame.cpp - Nine Almonds Game Source file
magicSquareGame.cpp - Magic Square Game Source file
reversiGame.cpp - Reversi Game Source file
Save/Restore:
When the user asks to quit, we ask if they would like to save the game. If so, we write "Reversi" followed by
a bool for whose turn it is and the names of the two players. After that we write the necessary info to construct
each game_piece in order, as before. If not, we just write "NO DATA" in the eponymous text file.
For restoring, if the file starts with "Reversi" then we start reading in the data that is there. We add construct
the game_pieces and add them to a temporary vector. If the length of the vector is the same as the dimensions say
it should be (i.e. correct number of pieces) then we replace the board vector with that vector.s
Cases:
1. INCORRECT COMMAND LINE ARGUMENTS
Input-
lab3.exe Reversi
Output-
lab4.exe Reversi
Please run the program as follows:
Usage: lab4.exe gameName player1 player2
* list names only for multiplayer game
Returns-
1 (i.e. failure_command_line_arguments)
2. QUIT GAME (SAVE + RESTORE)
Input-
lab4.exe Reversi Elie Bryan
...
Output-
7
6 X O
5 O X X
4 O O O O
3 X X O
2 X O
1
0
X 0 1 2 3 4 5 6 7
10 move(s) made
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
Input-
quit
Output-
Looks like you quit. You made 10 moves.
Do you want to save the game? Y/N :
Input-
Y
lab4.exe Reversi Elie Bryan
Output-
7
6 X O
5 O X X
4 O O O O
3 X X O
2 X O
1
0
X 0 1 2 3 4 5 6 7
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
...
3. BADLY FORMATTED INPUT --> TRY AGAIN
Input-
lab4.exe Reversi Elie Bryan
Output-
7
6
5
4 O X
3 X O
2
1
0
X 0 1 2 3 4 5 6 7
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
Input-
8 8
Badly formatted input. Does not match "x,y". Try again.
You've made an invalid move!
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
...
4. INVALID MOVE --> TRY AGAIN
Input-
lab4.exe Reversi Elie Bryan
Output-
7
6
5
4 O X
3 X O
2
1
0
X 0 1 2 3 4 5 6 7
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
0,0
That's an illegal move! Try again.
(Type "quit" to end the game or enter a valid starting square "x,y")
5. STALEMATE (*ALTERED SAVE FILE)
Input-
Reversi Elie Bryan
Output-
7
6
5
4 O
3
2
1 X
0
X 0 1 2 3 4 5 6 7
Elie, it's your turn. You are X
Oh no! There's a stalemate! No valid moves remain. You made 1 moves.
Returns-
9 (i.e failure_stalemate)
6. DONE (PLAYER 1 WINS)
Input-
lab4.exe Reversi Elie Bryan
...
1,6
Output-
7
6 X
5 X X X X
4 X X X
3 X X X
2 X
1 X
0
X 0 1 2 3 4 5 6 7
Congrats! It took you 9 moves to finish.
Returns-
0 (i.e. success)
7. DONE (PLAYER 2 WINS)
Input-
lab4.exe Reversi Elie Bryan
...
Output-
Bryan, it's your turn. You are O
(Type "quit" to end the game or enter a valid starting square "x,y")
Input-
7,6
Output-
7 X X X X O O O
6 O O O O O O O O
5 O X O X X O O
4 O O X X O O X O
3 O O X X O O X O
2 O O O O O X O O
1 O O O X X O O O
0 O O O O O O O O
X 0 1 2 3 4 5 6 7
58 move(s) made
Elie, it's your turn. You are X
(Type "quit" to end the game or enter a valid starting square "x,y")
Input-
7,7
7 X X X X X X X X
6 O O O O O O X O
5 O X O X X O O
4 O O X X O O X O
3 O O X X O O X O
2 O O O O O X O O
1 O O O X X O O O
0 O O O O O O O O
X 0 1 2 3 4 5 6 7
Bryan WINS!
Congrats! It took you 59 moves to finish.
Returns-
0 (i.e. success)