-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlevelfour.cc
38 lines (31 loc) · 874 Bytes
/
levelfour.cc
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
#include "levelfour.h"
#include "piece.h"
#include <cstdlib>
#include <memory>
#include <fstream>
LevelFour::LevelFour(int seed) {
}
Piece LevelFour::generatePiece() {
int randomIndex = rand() % 9;
Piece generatedPiece{Piece{pieces[randomIndex], 4}};
generatedPiece.makeHeavy();
return generatedPiece;
}
Piece LevelFour::generatePiece(std::string file) {
std::ifstream myFileStream{file};
char c;
while (myFileStream >> c) {
seqPieces.emplace_back(c); //add them to the queue
}
if (pieceCount > seqPieces.size() - 1) { //reset to the beginning of the queue
pieceCount = 0;
}
Piece generatedPiece{Piece{seqPieces.at(pieceCount), 4}};
++pieceCount; //increment to get next block
generatedPiece.makeHeavy();
return generatedPiece;
}
Piece LevelFour::generateCenterPiece() {
Piece centerPiece{Piece{'*', 4}};
return centerPiece;
}