-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtester.cpp
More file actions
160 lines (156 loc) · 4.28 KB
/
Copy pathtester.cpp
File metadata and controls
160 lines (156 loc) · 4.28 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
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
//#include <SFML/Graphics.hpp>
//#include <time.h>
//using namespace sf;
//
//int main()
//{
// srand(time(0));
//
// RenderWindow app(VideoMode(400, 400), "Minesweeper!");
//
// int w=32;
// int grid[12][12];
// int sgrid[12][12]; //for showing
//
// Texture t;
// t.loadFromFile("files/images/tile_hidden.png");
// Sprite s(t);
//
// for (int i=1;i<=10;i++)
// for (int j=1;j<=10;j++)
// {
// sgrid[i][j]=10;
// if (rand()%5==0) grid[i][j]=9;
// else grid[i][j]=0;
// }
//
// for (int i=1;i<=10;i++)
// for (int j=1;j<=10;j++)
// {
// int n=0;
// if (grid[i][j]==9) continue;
// if (grid[i+1][j]==9) n++;
// if (grid[i][j+1]==9) n++;
// if (grid[i-1][j]==9) n++;
// if (grid[i][j-1]==9) n++;
// if (grid[i+1][j+1]==9) n++;
// if (grid[i-1][j-1]==9) n++;
// if (grid[i-1][j+1]==9) n++;
// if (grid[i+1][j-1]==9) n++;
// grid[i][j]=n;
// }
//
// while (app.isOpen())
// {
// Vector2i pos = Mouse::getPosition(app);
// int x = pos.x/w;
// int y = pos.y/w;
//
// Event e;
// while (app.pollEvent(e))
// {
// if (e.type == Event::Closed)
// app.close();
//
// if (e.type == Event::MouseButtonPressed)
// if (e.key.code == Mouse::Left) sgrid[x][y]=grid[x][y];
// else if (e.key.code == Mouse::Right) sgrid[x][y]=11;
// }
//
// app.clear(Color::White);
//
// for (int i=1;i<=10;i++)
// for (int j=1;j<=10;j++)
// {
// if (sgrid[x][y]==9) sgrid[i][j]=grid[i][j];
// s.setTextureRect(IntRect(sgrid[i][j]*w,0,w,w));
// s.setPosition(i*w, j*w);
// app.draw(s);
// }
//
// app.display();
// }
//
// return 0;
//}
// class Timer {
// int min;
// int sec;
// vector<Sprite> minSprites;
// vector<Sprite> secSprites;
//
// public:
// Timer() : min(0), sec(0) {}
// Timer(int totalSeconds) {
// min = totalSeconds / 60;
// sec = totalSeconds % 60;
// }
//
// void setUpSprites(map<int, Texture>& digits) {
// minSprites.resize(2);
// secSprites.resize(2);
//
// updateSprites(digits); // Initial setup
// }
//
// void updateTime(int totalSeconds) {
// min = totalSeconds / 60;
// sec = totalSeconds % 60;
// }
//
// void updateSprites(map<int, Texture>& digits) {
// int minTens = min / 10;
// int minOnes = min % 10;
// int secTens = sec / 10;
// int secOnes = sec % 10;
//
// minSprites[0].setTexture(digits[minTens]);
// minSprites[1].setTexture(digits[minOnes]);
// secSprites[0].setTexture(digits[secTens]);
// secSprites[1].setTexture(digits[secOnes]);
//
// minSprites[0].setPosition(10, 10);
// minSprites[1].setPosition(30, 10);
// secSprites[0].setPosition(60, 10);
// secSprites[1].setPosition(80, 10);
// }
//
// vector<Sprite> getSprites() {
// vector<Sprite> all = minSprites;
// all.insert(all.end(), secSprites.begin(), secSprites.end());
// return all;
// }
// };
// class Leaderboard {
// int width, height;
// string filename;
// vector<Player*> players;
// public:
// Leaderboard();
// Leaderboard(int w, int h, string f) : width(w), height(h), filename(f) {}
// void readFromFile(const string& filename) {
// ifstream file(filename);
// if (file.is_open()) {
// string n;
// int t;
// int i = 0;
// while (file >> n >> t) {
// players[i]->name = n;
// players[i]->time = static_cast<chrono::duration<double>>(t);
// i++;
// }
// }
// }
// void addWinner(int time, string name) {
//
// }
// // void drawBoard() {
// // Text text;
// // text.setFont(font);
// // text.setCharacterSize(20);
// // text.setFillColor(Color::White);
// // text.setPosition(50, 50);
// // text.setString(createWinnerText());
// // window.draw(text);
// // }
// };