-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.c
785 lines (671 loc) · 16.1 KB
/
Main.c
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
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
#pragma warning (disable:4996)
#include<stdio.h>
#include<windows.h>
#include<time.h>
#include<conio.h>
//게임 보드의 가로 세로 길이
#define GAME_BOARD_WIDTH 10
#define GAME_BOARD_HEIGHT 20
//게임보드가 시작되는 좌표 위치
#define GAME_BOARD_START_X 30
#define GAME_BOARD_START_Y 2
//방향키 아스키코드 Define
#define STOP 8
#define LEFT 75
#define RIGHT 77
#define UP 72
#define SPACE 32
#define ENTER 13
//게임 보드 정보 배열
int gameBoardInfo[GAME_BOARD_HEIGHT + 1][GAME_BOARD_WIDTH + 2];
int speed; //게임 속도
int score; //게임 점수
int block_id; //블럭의 종류를 나타낼 int 형 변수
int next_block_id; //다음 블럭의 종류를 나타낼 int 형 변수
int checkEraseBlockCnt = 0;
char blockModel[][4][4] =
{
/* 첫 번째 블록
■
■■■ */
{
{0, 0, 0, 0},
{1, 0, 0, 0},
{1, 1, 1, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{0, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{1, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{1, 1, 0, 0},
{1, 0, 0, 0},
{1, 0, 0, 0} },
/* 두 번째 블록
■
■■■ */
{
{0, 0, 0, 0},
{0, 0, 1, 0},
{1, 1, 1, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 1, 0} },
{
{0, 0, 0, 0},
{0, 1, 1, 1},
{0, 1, 0, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0} },
/* 세 번째 블록
■
■■■ */
{
{0, 0, 0, 0},
{0, 1, 0, 0},
{1, 1, 1, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{0, 1, 0, 0},
{1, 1, 0, 0},
{0, 1, 0, 0} },
{
{0, 0, 0, 0},
{0, 0, 0, 0},
{1, 1, 1, 0},
{0, 1, 0, 0} },
{
{0, 0, 0, 0},
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 1, 0, 0} },
/* 네 번째 블록
■■■■ */
{
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0} },
{
{0, 0, 0, 0},
{0, 0, 0, 0},
{1, 1, 1, 1},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0} },
{
{0, 0, 0, 0},
{0, 0, 0, 0},
{1, 1, 1, 1},
{0, 0, 0, 0} },
/* 다섯 번째 블록
■■
■■ */
{
{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{
{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{
{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{
{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
/* 여섯 번째 블록
■■
■■ */
{
{0, 0, 0, 0},
{0, 1, 1, 0},
{1, 1, 0, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{0, 1, 1, 0},
{1, 1, 0, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0} },
/* 일곱 번째 블록
■■
■■ */
{
{0, 0, 0, 0},
{1, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{1, 1, 0, 0},
{1, 0, 0, 0},
{0, 0, 0, 0} },
{
{0, 0, 0, 0},
{1, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0} },
{
{0, 1, 0, 0},
{1, 1, 0, 0},
{1, 0, 0, 0},
{0, 0, 0, 0} },
/* 지우개 번째 블록
□
*/
{
{0, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} }
};
// 좌표 위치를 담을 구조체
COORD curPos;
//현재 콘솔의 커서 위치 좌표를 반환하는 함수
COORD GetCurrentCursorPos()
{
COORD curPoint;
CONSOLE_SCREEN_BUFFER_INFO curInfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo);
curPoint.X = curInfo.dwCursorPosition.X;
curPoint.Y = curInfo.dwCursorPosition.Y;
return curPoint;
}
//콘솔의 커서 위치를 지정한 좌표에 지정하는 함수
void SetCurrentCursorPos(int x, int y)
{
COORD pos = { x,y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
//커서를 콘솔창에 안보이게 하는 함수
void RemoveCursor()
{
CONSOLE_CURSOR_INFO curInfo;
GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo);
curInfo.bVisible = 0;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo);
}
//게임 정보를 담은 가상 배열에 벽으로 묘사되는 위치 인덱스 1을 할당
void setGameBoardInfo()
{
int x, y;
for (y = 0; y < GAME_BOARD_HEIGHT; y++)
{
gameBoardInfo[y][0] = 1;
gameBoardInfo[y][GAME_BOARD_WIDTH + 1] = 1;
}
for (x = 0; x < GAME_BOARD_WIDTH + 2; x++)
{
gameBoardInfo[GAME_BOARD_HEIGHT][x] = 1;
}
}
//블럭의 정보를 받고 해당 블록을 콘솔 창에 그리는 함수
void ShowBlock(char blockInfo[4][4])
{
int x, y;
COORD curPos = GetCurrentCursorPos();
for (y = 0; y < 4; y++)
{
for (x = 0; x < 4; x++)
{
SetCurrentCursorPos(curPos.X + (x * 2), curPos.Y + y);
if (blockInfo[y][x] == 1 && block_id != 28)
{
printf("■");
}
else if (blockInfo[y][x] == 1 && block_id == 28)
{
printf("□");
}
}
}
SetCurrentCursorPos(curPos.X, curPos.Y);
return 0;
}
//블록을 콘솔 창에서 지우는 함수
void DeleteBlock(char blockInfo[4][4])
{
int y, x;
COORD curPos = GetCurrentCursorPos();
for (y = 0; y < 4; y++)
{
for (x = 0; x < 4; x++)
{
SetCurrentCursorPos(curPos.X + (x * 2), curPos.Y + y);
if (blockInfo[y][x] == 1)
printf(" ");
}
}
SetCurrentCursorPos(curPos.X, curPos.Y);
}
//충돌 판정 확인하는 함수 (해당 좌표에 대해 특정 블럭이 충돌이면 0반환)
int DetectCollision(int posX, int posY, char blockModel[4][4])
{
int x, y;
int arrX = (posX - GAME_BOARD_START_X) / 2;
int arrY = (posY - GAME_BOARD_START_Y);
for (x = 0; x < 4; x++)
{
for (y = 0; y < 4; y++)
{
if (gameBoardInfo[arrY + y][arrX + x] == 1 && blockModel[y][x] == 1)
return 0;
}
}
return 1;
}
//충돌 판정 확인하는 함수 (해당 좌표에 대해 지우개 블럭이 충돌이면 0반환) (지우개 블럭 한정)
int DetectCollision_erase(int posX, int posY, char blockModel[4][4])
{
int x, y;
int arrX = (posX - GAME_BOARD_START_X) / 2;
int arrY = (posY - GAME_BOARD_START_Y);
for (x = 0; x < 4; x++)
{
for (y = 0; y < 4; y++)
{
if (arrY + y >= GAME_BOARD_HEIGHT && blockModel[y][x] == 1)
return 0;
else if (arrX + x >= GAME_BOARD_WIDTH + 1 && blockModel[y][x] == 1)
return 0;
else if (arrX + x <= 0 && blockModel[y][x] == 1)
return 0;
}
}
return 1;
}
//해당 위치에 특정 블럭의 모양에 대해 블럭을 지운다.
void setErase(int posX, int posY, char blockModel[4][4])
{
int x, y;
int arrX = (posX - GAME_BOARD_START_X) / 2;
int arrY = (posY - GAME_BOARD_START_Y);
for (x = 0; x < 4; x++)
{
for (y = 0; y < 4; y++)
{
if (gameBoardInfo[arrY + y][arrX + x] == 1 && blockModel[y][x] == 1)
gameBoardInfo[arrY + y][arrX + x] = 0;
}
}
}
int MoveDown()
{
if (block_id == 28) //지우개 블럭 예외
{
if (!DetectCollision_erase(curPos.X, curPos.Y + 1, blockModel[block_id]))
{
setErase(curPos.X, curPos.Y, blockModel[28]); //해당 위치의 블록을 지운다.
return 0;
}
setErase(curPos.X, curPos.Y, blockModel[28]);
DeleteBlock(blockModel[block_id]);
curPos.Y += 1;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
return 1;
}
else
{
//블록이 해당 방향으로 움직일 수 있는지 판별하는 조건문
if (!DetectCollision(curPos.X, curPos.Y + 1, blockModel[block_id]))
return 0;
DeleteBlock(blockModel[block_id]);
curPos.Y += 1;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
return 1;
}
}
void MoveRight()
{
if (block_id == 28)
{
if (!DetectCollision_erase(curPos.X + 2, curPos.Y, blockModel[block_id]))
{
setErase(curPos.X, curPos.Y, blockModel[28]);
return 0;
}
setErase(curPos.X, curPos.Y, blockModel[28]);
DeleteBlock(blockModel[block_id]);
curPos.X += 2;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
}
else
{
if (!DetectCollision(curPos.X + 2, curPos.Y, blockModel[block_id]))
return 0;
DeleteBlock(blockModel[block_id]);
curPos.X += 2;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
}
}
void MoveLeft()
{
if (block_id == 28)
{
if (!DetectCollision_erase(curPos.X - 2, curPos.Y, blockModel[block_id]))
{
setErase(curPos.X, curPos.Y, blockModel[28]);
return 0;
}
setErase(curPos.X, curPos.Y, blockModel[28]);
DeleteBlock(blockModel[block_id]);
curPos.X -= 2;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
}
else
{
if (!DetectCollision(curPos.X - 2, curPos.Y, blockModel[block_id]))
return 0;
DeleteBlock(blockModel[block_id]);
curPos.X -= 2;
SetCurrentCursorPos(curPos.X, curPos.Y);
ShowBlock(blockModel[block_id]);
}
}
//콘솔 창에 나타난 블럭을 회전시키는 함수
void RotateBlock()
{
int block_origin = block_id - block_id % 4; //회전하지 않은 원형 블럭의 배열 인덱스
int block_rotated = block_origin + (block_id + 1) % 4; //회전된 블럭의 배열 인덱스
if (!DetectCollision(curPos.X, curPos.Y, blockModel[block_rotated]))
return 0;
DeleteBlock(blockModel[block_id]);
block_id = block_rotated;
ShowBlock(blockModel[block_id]);
}
// 블록이 하강하여 정착하면, 해당 블록을 게임 정보를 담은 가상 배열에 1로 표기하여 게임보드를 업데이트하는 함수
void AddBlockToBoard()
{
int x, y, arrCurX, arrCurY;
for (y = 0; y < 4; y++)
{
for (x = 0; x < 4; x++)
{
arrCurX = (curPos.X - GAME_BOARD_START_X) / 2;
arrCurY = curPos.Y - GAME_BOARD_START_Y;
if (blockModel[block_id][y][x] == 1)
gameBoardInfo[arrCurY + y][arrCurX + x] = 1;
}
}
}
//갱신된 게임 판 정보를 토대로 블럭들을 다시 그리는 함수
void RedrawBlocks()
{
int x, y;
int cursX, cursY;
for (y = 0; y < GAME_BOARD_HEIGHT; y++)
{
for (x = 1; x < GAME_BOARD_WIDTH + 1; x++)
{
cursX = x * 2 + GAME_BOARD_START_X;
cursY = y + GAME_BOARD_START_Y;
SetCurrentCursorPos(cursX, cursY);
if (gameBoardInfo[y][x] == 1)
{
printf("■");
}
else { printf(" "); }
}
}
}
//블럭 한 줄이 다 채워졌는지 게임 판 밑에서 부터 검사
void RemoveFillUpLine()
{
int line, x, y;
for (y = GAME_BOARD_HEIGHT - 1; y > 0; y--)
{
for (x = 1; x < GAME_BOARD_WIDTH + 1; x++)
{
if (gameBoardInfo[y][x] != 1) //블럭 한 줄에 빈 칸이 있으면 종료
break;
}
if (x == GAME_BOARD_WIDTH + 1) //한 줄이 완성이 되어있으면
{
score += 10;
checkEraseBlockCnt++;
for (line = 0; y - line > 0; line++) //완성된 아래의 줄에서 다음 윗줄 메모리 복사
{
memcpy(&gameBoardInfo[y - line][1], &gameBoardInfo[(y - line) - 1][1],
GAME_BOARD_WIDTH * sizeof(int));
}
y++;
}
RedrawBlocks();
}
}
//게임 일시 정지
void StopGame()
{
int cnt = 0;
COORD temp = GetCurrentCursorPos();
SetCurrentCursorPos(60, 23);
printf("취소하려면 백스페이스 키를 다시 누르세요\n");
while (1) //탈출할 때 까지 무한 정지
{
while (!_kbhit())
{
Sleep(10);
}
int k = _getch();
if (k == STOP) //백 스페이스 키 누르면 해당 반복문 탈출 -> 게임 재개
break;
}
SetCurrentCursorPos(60, 23);
printf(" ");
SetCurrentCursorPos(temp.X, temp.Y);
}
//게임이 끝났는 지 확인하는 함수
int IsGameOver()
{
if (!DetectCollision(curPos.X, curPos.Y, blockModel[block_id]))
return 1;
return 0;
}
//스페이스 바 (즉시 하강)
void SpaceDown()
{
while (MoveDown());
}
//사용자에게 키 입력을 받는 함수
void InputOperationKey()
{
int i, key;
for (i = 0; i < 20; i++)
{
if (_kbhit() != 0)
{
key = _getch();
switch (key)
{
case LEFT:
MoveLeft();
break;
case RIGHT:
MoveRight();
break;
case UP:
RotateBlock();
break;
case SPACE:
SpaceDown();
break;
case STOP:
StopGame();
}
}
Sleep(speed);
}
}
//게임 보드 판을 그리는 함수
void DrawGameBoard()
{
int x, y;
for (y = 0; y <= GAME_BOARD_HEIGHT; y++)
{
SetCurrentCursorPos(GAME_BOARD_START_X, GAME_BOARD_START_Y + y);
if (y == GAME_BOARD_HEIGHT)
printf("□");
else
printf("□");
}
for (y = 0; y <= GAME_BOARD_HEIGHT; y++)
{
SetCurrentCursorPos(GAME_BOARD_START_X + (GAME_BOARD_WIDTH + 1) * 2, GAME_BOARD_START_Y + y);
if (y == GAME_BOARD_HEIGHT)
printf("□");
else
printf("□");
}
for (x = 1; x <= GAME_BOARD_WIDTH + 1; x++)
{
SetCurrentCursorPos(GAME_BOARD_START_X + x * 2, GAME_BOARD_START_Y + GAME_BOARD_HEIGHT);
printf("□");
}
}
//게임 진행 스코어를 화면에 나타내는 함수
void DrawScore()
{
SetCurrentCursorPos(60, 20);
printf("Score : %d", score);
}
//다음에 나타날 블럭을 콘솔창 오른쪽에 출력하여 플레이어 눈으로 확인할 수 있게 하는 함수
void ShowNextBlock()
{
COORD temp = GetCurrentCursorPos();
SetCurrentCursorPos(60, 9);
printf("다음에 나타날 블럭");
SetCurrentCursorPos(60, 10);
DeleteBlock(blockModel[block_id]);
for (int y = 0; y < 4; y++)
{
for (int x = 0; x < 4; x++)
{
SetCurrentCursorPos(60+ (x * 2), 10 + y);
if (blockModel[next_block_id][y][x] == 1 && next_block_id != 28)
{
printf("■");
}
else if (blockModel[next_block_id][y][x] == 1 && next_block_id == 28)
{
printf("□");
}
}
}
SetCurrentCursorPos(temp.X, temp.Y);
}
void ShowManual()
{
printf("Enter : 플레이 시작");
const char* str[7];
int i = 1;
str[0] = "\n\n\n 테르리스 게임";
str[1] = "\n\n\n 블럭 이동 : 방향키";
str[2] = "\n\n\n 블럭 하강 : 스페이스 바";
str[3] = "\n\n\n 일시정지 : 백 스페이스";
str[4] = "\n\n\n 5개의 줄을 완성시키면 다음 하강하는 블럭으로 지우개 블럭이 설정됩니다.";
str[5] = "\n\n\n 지우개 블럭은 하강하면서 다른 블럭과 충돌 시 다른 블럭들을 삭제합니다. \n\n\n 순발력을 발휘하여 지우개 블럭을 잘 활용해 보세요.";
str[6] = "\n\n\n 플레이 하시려면 엔터 키를 누르세요.";
for (int i = 0; i < 7; i++)
{
printf("%s", str[i]);
}
while (1) {
while (!_kbhit());
int key = _getch();
if (key == ENTER) {
break;
}
else
continue;
}
}
int main()
{
ShowManual();
system("cls"); //콘솔창 초기화
srand((unsigned int)time(NULL));
RemoveCursor();
DrawGameBoard();
setGameBoardInfo();
speed = 5;
next_block_id = rand() % 28; //랜덤한 블럭 원형을 생성한다.
while (1) //전체 게임 진행을 위한 반복문
{
block_id = next_block_id;
SetCurrentCursorPos(GAME_BOARD_START_X + GAME_BOARD_WIDTH, 0);
curPos = GetCurrentCursorPos();
DrawScore();
if (checkEraseBlockCnt >= 5) //5번의 줄을 지울 때 마다 다음 블록으로 지우개 블록 설정
{
next_block_id = 28;
checkEraseBlockCnt = 0;
}
else
{
next_block_id = rand() % 28; //그 외에는 랜덤하게 블록 생성
}
ShowNextBlock(); //다음에 떨어질 블록을 오른쪽 화면에 보이게
//벽돌이 위에 더 생성될 수 없으면 GameOver
if (IsGameOver())
break;
while (1) //벽돌이 떨어지는 것을 구현한 반복문
{
if (MoveDown() == 0) //MoveDown은 밑에 블럭이 있어 더 내려가지 못하면 0을 반환,
{
if (block_id == 28)
{
RedrawBlocks();
break;
}
AddBlockToBoard(); //게임 블록 정보 배열에 해당 블록 추가
RemoveFillUpLine(); //한 줄이 완성되어있는지 검사 후, 완성 되어있으면 줄 지우고 블록 최신화
break;
}
InputOperationKey(); //사용자에게 키 입력 받기
}
}
SetCurrentCursorPos(60, 5);
puts("Game Over!\n");
getchar();
return 0;
}