-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
766 lines (662 loc) · 25.4 KB
/
main.cpp
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
#include <QtWidgets>
#include "mybutton.h"
#define maxSide 25
#define maxMines 99
int sideSize = 10;
int totalMines = 10;
//track which mouse button is clicked
bool rightClick, leftClick;
//used to store tile click values
int click[2];
class Minesweeper : public QWidget {
public:
Minesweeper(QWidget *parent = nullptr) : QWidget(parent) {
this -> setWindowTitle("Minesweeper");
this->setFixedSize(300, 350);
QVBoxLayout * mainlayout = new QVBoxLayout(this);
QHBoxLayout * lcdlayout= new QHBoxLayout();
lcdTimer = new QLCDNumber(this); //timer will increase until 999
QTimer *timer = new QTimer(this);
lcdTimer->setDigitCount(3);
timer->setInterval(1000);
lcdTimer->display(0);
connect(timer, &QTimer::timeout, this, &Minesweeper::updateTimerDisplay);
timer->start();
lcdlayout->addWidget(lcdTimer);
mineCounter = new QLCDNumber(this); //counter start form 10 and change as play flag
mineCounter->setDigitCount(3);
lcdlayout->addWidget(mineCounter);
mineCounter->display(numMines);
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
hiddenBoard[i][j] = new MyButton(this, false, false, false);
}
}
//generate mine grid
setMines(mines, hiddenBoard);
gridlayout = new QGridLayout(); //initualize minefield
gridlayout -> setSpacing(0);
gridlayout -> setContentsMargins(0,0,0,0);
for (int row = 0; row < numRows; ++row) {
for (int col = 0; col < numCols; ++col) {
//check if matches grind
hiddenBoard[row][col]->setFixedSize(28,30);
hiddenBoard[row][col]->setProperty("row", row);
hiddenBoard[row][col]->setProperty("col", col);
connect( hiddenBoard[row][col], &MyButton::leftClicked, this, &Minesweeper::onButtonLeftClicked); //if leftclicked
connect( hiddenBoard[row][col], &MyButton::rightClicked, this, &Minesweeper::onButtonRightClicked); //if rightclicked
gridlayout->addWidget( hiddenBoard[row][col], row, col);
}
}
mainlayout->addLayout(lcdlayout);
mainlayout->addLayout(gridlayout);
setLayout(mainlayout); //put lcd and grid together
}
//check if selected tile is a valid tile
bool isValid(int row, int col){
//return true if row and col are within range of 0-10
return (row >= 0) && (row < sideSize) && (col >= 0) && (col < sideSize);
}
int countAdjMines(int row, int col){
int count = 0;
// For naming positions we use the classic number pad configuration
// i.e. the clicked tile is "5"
// before each mine check, check that adjacent tile is a valid tile
// top left = positon 7
if(isValid (row-1, col-1) == true){
if(hiddenBoard[row-1][col-1]->getminestatus() == true){
count++;
}
}
// position 8
if(isValid (row-1, col) == true){
if(hiddenBoard[row-1][col]->getminestatus() == true){
count++;
}
}
// position 9
if(isValid (row-1, col+1) == true){
if(hiddenBoard[row-1][col+1]->getminestatus() == true){
count++;
}
}
// position 4
if(isValid (row, col-1) == true){
if(hiddenBoard[row][col-1]->getminestatus() == true){
count++;
}
}
// position 6
if(isValid (row, col+1) == true){
if(hiddenBoard[row][col+1]->getminestatus() == true){
count++;
}
}
// position 1
if(isValid (row+1, col-1) == true){
if(hiddenBoard[row+1][col-1]->getminestatus() == true){
count++;
}
}
// position 2
if(isValid (row+1, col) == true){
if(hiddenBoard[row+1][col]->getminestatus() == true){
count++;
}
}
// position 3
if(isValid (row+1, col+1) == true){
if(hiddenBoard[row+1][col+1]->getminestatus() == true){
count++;
}
}
return count;
}
bool playGame(int row, int col){
qDebug() << "entered playGame" << row << " " << col;
//base case for recusion
if(hiddenBoard[row][col]->getflipstatus() == true){
return false;
}
hiddenBoard[row][col]->setfliptrue();
moveCount++;
qDebug() << "past base case";
// Did not click mine
// calc number of adjacent mines and place on board
int count = countAdjMines(row, col);
qDebug() << "count " << count;
if(count == 0){
hiddenBoard[row][col]->setStyleSheet("background-color: black");
}
else if(count == 1){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/1.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 2){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/2.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 3){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/3.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 4){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/4.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 5){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/5.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 6){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/6.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 7){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/7.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
else if(count == 8){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/8.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[row][col]->setIcon(ButtonIcon);
}
if(count == 0){
// position 7
if(isValid (row-1, col-1) == true){
// adjacent tile isnt mine, so click on it
playGame(row-1, col-1);
}
// position 8
if(isValid (row-1, col) == true){
playGame(row-1, col);
}
// position 9
if(isValid (row-1, col+1) == true){
playGame(row-1, col+1);
}
// position 4
if(isValid (row, col-1) == true){
playGame(row, col-1);
}
// position 6
if(isValid (row, col+1) == true){
playGame(row, col+1);
}
// position 1
if(isValid (row+1, col-1) == true){
playGame(row+1, col-1);
}
// position 2
if(isValid (row+1, col) == true){
playGame(row+1, col);
}
// position 3
if(isValid (row+1, col+1) == true){
playGame(row+1, col+1);
}
}
// no mine so game is not over
return false;
}
void setMines(int mines[][2], MyButton * realBoard[][10]){
bool mark[100];
memset(mark, false, sizeof(mark));
srand(time(nullptr));
for(int i = 0; i < totalMines; ){
int x = rand() % (10);
int y = rand() % (10);
//place mine if no mine has already been placed on this tile
if(mark[x * 10 + y] == false){
//row and column index
mines[i][0] = x;
mines[i][1] = y;
//place mine
realBoard[mines[i][0]][mines[i][1]]->changeminestatus();
qDebug() << "mine at (" << mines[i][0] << ", " << mines[i][1] << ")";
mark[x * 10 + y] = true;
i++; //increment only after a mine has been successfully placed
}
}
return;
}
//called when user left-clicks on a tile. reveals square and adjcaent ones without a mine
void sweep(int i, int j) {
qDebug() << "move count" << moveCount;
qDebug() << "Sweep at (" << i << ", " << j << ")";
//qDebug() << clickedButton->property("row").toInt() << " " << clickedButton->property("col").toInt();
if(moveCount == 0){
TARGET: if(hiddenBoard[i][j]->getminestatus() == true){
qDebug() << "triggered";
//if first move was mine, remove it and move it to next avaliable location
for(int x = 0; x<10; x++){
for(int y = 0; y < 10; y++){
if(hiddenBoard[x][y]->getminestatus() == false){
hiddenBoard[x][y]->changeminestatus();
hiddenBoard[i][j]->changeminestatus();
goto TARGET;
}
}
}
}
}
//check if move was valid, if so increment as successful move
if(isValid(i, j) && hiddenBoard[i][j]->getflipstatus() == false){
if(hiddenBoard[i][j]->getminestatus() == true){
reveal();
return;
}
qDebug() << "Playing the Game!";
playGame(i, j);
//get if tile/surroundings are mine
}
//Game is won -- display victory
if(moveCount == maxMoves){
//victory display
victory();
}
}
//called when user right-clicks? on a tile. place flag on tile
void mine(int i, int j) {
qDebug() << "Mine at (" << i << ", " << j << ")";
click[0] = i;
click[1] = j;
}
void reveal(){
qDebug() << "Game Over";
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(hiddenBoard[i][j]->getminestatus() == true){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/mine.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[i][j]->setIcon(ButtonIcon);
}
}
}
}
void victory(){
qDebug() << "Victory";
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(hiddenBoard[i][j]->getminestatus() == true){
QPixmap pixmap("/home/aidannow/EC535/lab5/Working_Minesweeper/images/checkmark.png");
QIcon ButtonIcon(pixmap);
hiddenBoard[i][j]->setIcon(ButtonIcon);
}
}
}
}
private slots:
void updateTimerDisplay()
{
if(lcdTimer->intValue() < 999){
int currentTime = lcdTimer->intValue() + 1;
lcdTimer->display(currentTime);
}
}
void onButtonLeftClicked() {
MyButton *button = qobject_cast<MyButton *>(sender());
int i = button->property("row").toInt();
int j = button->property("col").toInt();
//QPixmap pixmap("C:/Users/aidan/OneDrive/Documents/BU_Classes/2023_Spring/Embedded Systems/Lab5/images/1.png");
//QIcon ButtonIcon(pixmap);
//button->setIcon(ButtonIcon);
if (QGuiApplication::keyboardModifiers() == Qt::NoModifier) {
sweep(i, j);
}
}
void onButtonRightClicked() {
MyButton *button = qobject_cast<MyButton *>(sender());
int i = button->property("row").toInt();
int j = button->property("col").toInt();
int minesLeft = mineCounter->intValue();
if(minesLeft > 0 && !button->getflagstatus() && !button->getflipstatus()){ //if it is not fliped or flagged
button->changeflagstatus();
minesLeft--;
mineCounter->display(minesLeft);
QPixmap pixmap("C:/Users/aidan/OneDrive/Documents/BU_Classes/2023_Spring/Embedded Systems/Lab5/images/flag.png"); //set flag
QIcon ButtonIcon(pixmap);
button->setIcon(ButtonIcon);
if (QGuiApplication::keyboardModifiers() == Qt::NoModifier) {
mine(i, j);
}
}else if(minesLeft < 10 && button->getflagstatus()){ //if it is flaged
button->changeflagstatus();
minesLeft++;
mineCounter->display(minesLeft);
button->setIcon(QIcon()); //reset
}
}
private:
const int numRows = 10;
const int numCols = 10;
const int numMines = 10;
int moveCount = 0;
bool gameOver = false;
int maxMoves = numRows * numCols - numMines;
MyButton *hiddenBoard[10][10];
int mines[10][2]; //stores (x,y) coordinates of all mines
QGridLayout *gridlayout;
QElapsedTimer timer;
QLCDNumber *mineCounter;
QLCDNumber *lcdTimer;
};
class MinesweeperStartingPage : public QWidget
{
public:
MinesweeperStartingPage(QWidget *parent = nullptr) : QWidget(parent)
{
// Create the layout for the starting page
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setAlignment(Qt::AlignCenter);
layout->setContentsMargins(50, 50, 50, 50);
// Create the title label
QLabel *title = new QLabel(tr("Minesweeper"));
QFont titleFont = title->font();
titleFont.setPointSize(32);
title->setFont(titleFont);
layout->addWidget(title, 0, Qt::AlignCenter);
// Create the subtitle label
QLabel *subtitle = new QLabel(tr("Select a difficulty level:"));
QFont subtitleFont = subtitle->font();
subtitleFont.setPointSize(16);
subtitle->setFont(subtitleFont);
layout->addWidget(subtitle, 0, Qt::AlignCenter);
// Create the difficulty buttons
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->setSpacing(50);
buttonLayout->setContentsMargins(0, 30, 0, 0);
QPushButton *beginnerButton = new QPushButton(tr("Beginner"));
beginnerButton->setStyleSheet("background-color: green; color: black;");
connect(beginnerButton, &QPushButton::clicked, this, &MinesweeperStartingPage::beginnerClicked);
beginnerButton->setFixedWidth(100);
buttonLayout->addWidget(beginnerButton, 0, Qt::AlignCenter);
QPushButton *intermediateButton = new QPushButton(tr("Intermediate"));
intermediateButton->setStyleSheet("background-color: yellow; color: black;");
connect(intermediateButton, &QPushButton::clicked, this, &MinesweeperStartingPage::intermediateClicked);
intermediateButton->setFixedWidth(100);
buttonLayout->addWidget(intermediateButton, 0, Qt::AlignCenter);
QPushButton *expertButton = new QPushButton(tr("Expert"));
expertButton->setStyleSheet("background-color: red; color: black;");
connect(expertButton, &QPushButton::clicked, this, &MinesweeperStartingPage::expertClicked);
expertButton->setFixedWidth(100);
buttonLayout->addWidget(expertButton, 0, Qt::AlignCenter);
layout->addLayout(buttonLayout);
}
signals:
void beginnerClicked(){
Minesweeper *minesweeper = new Minesweeper;
minesweeper->show();
close();
}
void intermediateClicked(){
Minesweeper *minesweeper = new Minesweeper;
minesweeper->show();
close();
}
void expertClicked(){
Minesweeper *minesweeper = new Minesweeper;
minesweeper->show();
close();
}
};
/*
//update current board
void updateBoard(char myBoard[][10]){
int i, j;
for(i = 0; i < 10; i++){
for(j = 0; j < 10; j++){
}
}
}
//check if selected tile is a valid tile
bool isValid(int row, int col){
//return true if row and col are within range of 0-10
return (row >= 0) && (row < sideSize) && (col >= 0) && (col < sideSize);
}
//check if selected tile is a mine
bool isMine(int row, int col, char board[][10]){
if(board[row][col] == '*')
return true;
else
return false;
}
int countAdjMines(int row, int col, int mines[][2], char realBoard[][10]){
int count = 0;
// For naming positions we use the classic number pad configuration
// i.e. the clicked tile is "5"
// before each mine check, check that adjacent tile is a valid tile
// top left = positon 7
if(isValid (row-1, col-1) == true){
if(isMine(row-1, col-1, realBoard) == true){
count++;
}
}
// position 8
if(isValid (row-1, col) == true){
if(isMine(row-1, col, realBoard) == true){
count++;
}
}
// position 9
if(isValid (row-1, col+1) == true){
if(isMine(row-1, col+1, realBoard) == true){
count++;
}
}
// position 4
if(isValid (row, col-1) == true){
if(isMine(row, col-1, realBoard) == true){
count++;
}
}
// position 6
if(isValid (row, col+1) == true){
if(isMine(row, col+1, realBoard) == true){
count++;
}
}
// position 1
if(isValid (row+1, col-1) == true){
if(isMine(row+1, col-1, realBoard) == true){
count++;
}
}
// position 2
if(isValid (row+1, col) == true){
if(isMine(row+1, col, realBoard) == true){
count++;
}
}
// position 3
if(isValid (row+1, col+1) == true){
if(isMine(row+1, col+1, realBoard) == true){
count++;
}
}
return count;
}
//Recursive funtion used to play the game
bool playGame(char myBoard[][10], char realBoard[][10], int mines [][2],int row, int col){
//base case for recusion
if(myBoard[row][col] != '-'){
return false;
}
int i;
//if a mine was clicked, game over
if(realBoard[row][col] == '*'){
myBoard[row][col] = '*';
qDebug() << "Mine found";
for (i = 0; i < totalMines; i++){
myBoard[mines[i][0]][mines[i][1]] = '*';
}
// add function to print over board
//updateBoard(myBoard);
return true;
}
else{
// Did not click mine
// calc number of adjacent mines and place on board
int count = countAdjMines(row, col, mines, realBoard);
myBoard[row][col] = count + '0';
qDebug() << "Safe!";
if(!count){
if(isValid (row-1, col-1) == true){
// adjacent tile isnt mine, so click on it
if(isMine(row-1, col-1, realBoard) == false){
playGame(myBoard, realBoard, mines, row-1, col-1);
}
}
// position 8
if(isValid (row-1, col) == true){
if(isMine(row-1, col, realBoard) == true){
playGame(myBoard, realBoard, mines, row-1, col);
}
}
// position 9
if(isValid (row-1, col+1) == true){
if(isMine(row-1, col+1, realBoard) == true){
playGame(myBoard, realBoard, mines, row-1, col+1);
}
}
// position 4
if(isValid (row, col-1) == true){
if(isMine(row, col-1, realBoard) == true){
playGame(myBoard, realBoard, mines, row, col-1);
}
}
// position 6
if(isValid (row, col+1) == true){
if(isMine(row, col+1, realBoard) == true){
playGame(myBoard, realBoard, mines, row, col+1);
}
}
// position 1
if(isValid (row+1, col-1) == true){
if(isMine(row+1, col-1, realBoard) == true){
playGame(myBoard, realBoard, mines, row+1, col-1);
}
}
// position 2
if(isValid (row+1, col) == true){
if(isMine(row+1, col, realBoard) == true){
playGame(myBoard, realBoard, mines, row+1, col);
}
}
// position 3
if(isValid (row+1, col+1) == true){
if(isMine(row+1, col+1, realBoard) == true){
playGame(myBoard, realBoard, mines, row+1, col+1);
}
}
}
// no mine so game is not over
return false;
}
}
// randomly place mines on board
void setMines(int mines[][2], char realBoard[][10]){
bool mark[100];
memset(mark, false, sizeof(mark));
for(int i = 0; i < totalMines; ){
int random = rand() % (100);
int x = random / 10;
int y = random % 10;
//place mine if no mine has already been placed on this tile
if(mark[random] == false){
//row and column index
mines[i][0] = x;
mines[i][1] = y;
//place mine
realBoard[mines[i][0]][mines[i][1]] = '*';
mark[random] = true;
i++; //increment only after a mine has been successfully placed
}
}
return;
}
void init(char realBoard[][10], char myBoard[][10]){
//use random number to create unique config
srand(time(NULL));
//assign tiles
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
//upon start no tiles have mines
//added after first move is made
myBoard[i][j] = realBoard[i][j] = '-';
}
}
return;
}
//function to play minesweeper
void minesweeper_game(){
// used to check if game should continue
bool gameOver = false;
int row, col;
int maxMoves = 10 * 10 - totalMines;
// initalize boards
char realBoard[10][10], myBoard[10][10];
// initalize number of mines
int mines[totalMines][2];
// set up boards
init(realBoard, myBoard);
setMines(mines, realBoard);
int moveCount = 0; //check if first move has been made
//core while loop of game
while(gameOver == false){
//update and print board to user
//updateBoard(myBoard);
//if left click user is slecting tile
if(leftClick){
row = click[0];
col = click[1];
if(moveCount == 0){
TARGET: if(isMine(row, col, realBoard) == true){
//if first move was mine, remove it and move it to next avaliable location
for(int i = 0; i<10; i++){
for(int j = 0; j < 10; j++){
if(realBoard[i][j] != '*'){
realBoard[i][j] = '*';
realBoard[row][col] = '-';
goto TARGET;
}
}
}
}
}
moveCount++;
//get if tile/surroundings are mine
gameOver = playGame(myBoard, realBoard, mines, row, col);
//Game is won -- display victory
if((gameOver == false) && (moveCount == maxMoves)){
//victory display
gameOver = true;
}
//set left click as false since click has been handled
leftClick = false;
}
//if right click, place flag
if(rightClick){
row = click [0];
col = click [1];
// add flag variable to tile associated with row and col
//button[row][col].flagged = true;
rightClick = false;
}
}
}
*/
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MinesweeperStartingPage startPage;
startPage.setFixedSize(400, 300); // Set window size to 400x300 pixels
startPage.show();
return app.exec();
}