Repository navigation
Expand file tree
/
Copy pathbonus.cpp
More file actions
100 lines (79 loc) · 2.78 KB
/
Copy pathbonus.cpp
File metadata and controls
100 lines (79 loc) · 2.78 KB
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
#include <fstream>
#include <iostream>
#include <string>
#include "bonus.h"
using namespace std;
/*
int bonus::saveGame(std::string path) //Save minesweeper object state to file
{
}
*/
/*
int bonus::loadGame(std::string path) //Load minesweeper object state from file
{
}
*/
int bonus::saveStatistics(std::string path) //Save overall game statistics to file
{
ofstream stat;
stat.open("game_stat.dat");
stat.setf(ios::fixed);
stat.precision(2);
//print game statistics
stat<<"Game statistics: "<<endl<<"---- ----------"<<endl<<endl;
stat<<"Win(s)- "<<wins<<endl;
stat<<"Loss(s)- "<<loss<<endl;
stat<<"win-loss-ratio- "<<ratio<<endl;
stat<<"Current win streak- "<<winStreak<<endl;
stat<<"Longest win streak- "<<longestWinStreak<<endl;
return 1;
}
/*int bonus::loadStatistics(std::string path) //Load overall game statistics from file
{
}
*/
int bonus::getWins() //Returns # of wins
{
return wins;
}
void bonus::setWins() //Modify # of wins
{
wins++;
}
int bonus::getLoss() //Returns # of losses
{
return loss;
}
void bonus::setLoss() //Modify # of losses
{
loss++;
}
double bonus::getRatio() //Returns Win/loss Ratio
{
return ratio;
}
int bonus::getWinStreak() //Returns current Win Streak (consecutive wins)
{
return winStreak;
}
void bonus::setWinStreak() //Modifies current Win Streak # (consecutive wins)
{
winStreak++;
}
int bonus::getLongestWinStreak() //Returns longest Win Streak (largest win streak seen)
{
return longestWinStreak;
}
void bonus::setLongestWinStreak() //Modifies longest Win Streak (largest win streak seen)
{
if(longestWinStreak<winStreak)
longestWinStreak=winStreak;
}
void bonus::initialMineField(int fpX, int fpY) //Initialize game board given first revealed tile.
//Overrides minesweeper.initialMineField(fpX,fpY)
{
}
void bonus::calcRatio() //Calculates Win/loss Ratio
{
ratio=wins/loss;
}