-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewgame.cpp
More file actions
35 lines (29 loc) · 841 Bytes
/
newgame.cpp
File metadata and controls
35 lines (29 loc) · 841 Bytes
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
#include "matrix.h"
#include "nimber.h"
#include "hash.h"
Nimber findValue(Matrix & game, Hashtable & table, Hashtable & moves, int prime, int call);
Nimber newGame(Matrix & game, Hashtable & table, Hashtable & moves, int prime)
{
cout << "Enter the number of rows: ";
int numrows;
cin >> numrows;
cout << "Enter the number of columns: ";
int numcols;
cin >> numcols;
game.resize(numrows, numcols);
int rowindex,colindex;
for (rowindex = 0; rowindex < numrows; rowindex++) {
cout << "Enter row " << rowindex << ": ";
for (colindex = 0; colindex < numcols; colindex++) {
cin >> game[rowindex][colindex];
}
}
cout << "You entered: " << endl;
game.print();
cout << "which normalizes to: " << endl;
game.normalize();
game.print();
cout << endl;
moves.clear();
return findValue(game, table, moves, prime, 0);
}