-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (41 loc) · 1.16 KB
/
main.cpp
File metadata and controls
50 lines (41 loc) · 1.16 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
#include <SFML/Graphics.hpp>
#include <cmath>
#include <vector>
#include <iostream>
#include <random>
#include <time.h>
#include "InteractiveGame.h"
#include "AIChampionship.h"
int main()
{
srand(time(NULL));
sf::ContextSettings settings;
settings.antialiasingLevel = 8;
sf::RenderWindow window(sf::VideoMode(600, 600), "Dart Game", sf::Style::Default, settings);
int playerScoreArray[8][8]{};
int aiPlayTimes{ 100000 };
for (int i{ 0 }; i < aiPlayTimes; ++i)
{
// Play championship
AIChampionship aiChampionship = AIChampionship();
aiChampionship.Play();
// Store score in a 2d array
playerScoreArray[aiChampionship.Player1Wins()][aiChampionship.Player2Wins()]++;
}
for (int i{ 0 }; i < 8; ++i)
{
for (int j{ 0 }; j < 8; ++j)
{
// Only print out numbers with 7 (because thats the end of the game)
if (i == 7 || j == 7)
std::cout << "Joe " << i << " - " << j << " Sid ----- Frequency: "
<< playerScoreArray[i][j] << " Percentage: "
<< (float)(100 * (float)playerScoreArray[i][j] / (float)aiPlayTimes) << "%" << std::endl;
}
}
while (window.isOpen())
{
InteractiveGame interactiveGame = InteractiveGame(&window);
}
return 0;
}