1596, 1/80 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   whqkdnf000
   http://hack-ing.ohpy.com
   C·Î ¸¸µç »ç°Ý°ÔÀÓ(ÁÖ¼®´Þ¾Æ³ùÀ½)

http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=916 [º¹»ç]


#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <stdlib.h>
/*
* < »ç°Ý°ÔÀÓ >
*
* ȣȯ¼º
* ÀÌ ÇÁ·Î±×·¥Àº Borland C++ 5.5 ¿¡¼­ ÄÄÆÄÀÏÇÏ°í ½ÃÇèµÇ¾ú½À´Ï´Ù.
*
* °ÔÀÓ¼³¸í
* »ç°ÝÀåÀº °¢°¢ Çϳª¾¿ÀÇ È­»ìÀ» Æ÷ÇÔÇÏ°í ÀÖ´Â ¾ÆÈ©°³ÀÇ ·¹ÀÎÀ¸·Î ¸¸µé¾îÁ® ÀÖ½À´Ï´Ù.
* ÇÁ·Î±×·¥ÀÌ ½ÃÀÛµÇ¸é ·¹ÀÎÀÇ ¿À¸¥ÂÊ¿¡ ÇÑ°³ÀÇ Å¸°Ù(X)ÀÌ ³ªÅ¸³³´Ï´Ù.
* ´ç½ÅÀÇ °úÁ¦´Â È­»ìµé ÁßÀÇ Çϳª·Î Ÿ°ÙÀ» ¸ÂÃß´Â °Í ÀÔ´Ï´Ù.
* È­»ìÀ» ½î·Á¸é ·¹ÀÎ ¹øÈ£¸¦ ´©¸£¸é µË´Ï´Ù.
* 25°³ÀÇ Å¸°ÙÀÌ ³ªÅ¸³­ ÈÄ¿¡, °ÔÀÓÀº ³¡³ª°í, ÃÖÁ¾Á¡¼ö°¡ Ãâ·ÂµË´Ï´Ù.
*
* ³­À̵µ º¯°æÇϱâ
* ³­À̵µ¸¦ º¯°æÇÏ·Á¸é ShootArrow(int)ÇÔ¼öÀÇ µÎ¹ø° for·çÇÁ¸¦ º¯°æÇؼ­ È­»ìÀÇ ¼Óµµ¸¦ º¯°æÇÏ¸é µË´Ï´Ù.
* È­»ìÀÌ ÃµÃµÈ÷ ³ª°¥¼ö·Ï ¸ÂÃß±â±îÁöÀÇ ½Ã°£À» ¼ÒºñÇϹǷΠ³­À̵µ´Â ³ô¾ÆÁý´Ï´Ù.
* PlayGame(void)ÇÔ¼öÀÇ TIME_LIMIT°ªÀ» 2ÃÊ·Î ¸ÂÃß¾î ³õ¾Ò±â ¶§¹®¿¡
* È­»ìÀÌ ¹ß»çµÇ´Âµ¥ 2ÃÊ°¡ °É¸°´Ù¸é °ÔÀÓÀÌ ¾ÈµÇÁÒ. ¿ª½Ã Á¦Çѽ𣵵 ¸¶À½´ë·Î ¼öÁ¤Çϼ¼¿ä.
*/

#define true 1
#define false 0
typedef int bool;

void ShowScore(int);
int PlayGame(void);
void EraseTarget(int);
void ShootArrow(int);
int ShowTarget(void);
void DrawScreen(void);

int main(void) {
        int score;
        srand((unsigned) time(NULL));
        DrawScreen();
        score = PlayGame();
        ShowScore(score);
        
        return 0;
}

void DrawScreen(void) {
        int x;
        clrscr();
        gotoxy(20, 11);
        printf("°ÔÀÓÀ» ½ÃÀÛÇÏ·Á¸é ¾Æ¹«Å°³ª ´©¸£¼¼¿ä.");
        getch();
        clrscr();
        
        for (x = 1; x <= 10; x++) {      // ·çÇÁ´Â Çѹø¿¡ ÇÑ °³ÀÇ ÇìÀκ®°ú ÇÑ°³ÀÇ È­»ìÀ» ±×¸°´Ù.
                gotoxy(1, x * 2 + 2);
                printf("-----------------------------------");
                if (x < 10) {
                        gotoxy(1, x * 2 + 3);
                        printf("%d%s", x, "  >>-->");
                }
        }
}

void EraseTarget(int target_position) {
        gotoxy(60, target_position * 2 + 3);
        printf(" ");
}

int PlayGame(void) {
        int score = 0;
        int target_position;
        long start_time;
        bool shot_fired;
        int num;          // °ªÀ¸·Î ÀúÀåÇÏ´Â ¼ýÀÚÅ°
        const int TIME_LIMIT = 2;   // ÇÑ Å¸°Ù´ç Á¦Çѽð£ 2ÃÊ
        
        int x;
        for (x = 1; x <= 20; x++) {         // ÀÌ ·çÇÁ´Â 25°³ÀÇ Å¸°ÙÀ» ºÎ¿©ÇÑ´Ù.
                target_position = ShowTarget();
                start_time =  time(NULL);      // ¿©±â¿¡¼­ ½ÃÀ۽ð£ÀÌ ÀúÀåµÈ´Ù.
                shot_fired = false;
                
                // Á¦Çѽð£°ú ³²Àº È­»ì°³¼ö¸¦ ¾Ë·ÁÁÜ
                gotoxy(44, 2);
                printf("%s%d%s", "³²Àº È­»ì: ", 21 - x, " ");
                gotoxy(10, 2);
                printf("%s%d%s", "ÇÑ Å¸°Ù ´ç ½Ã°£Á¦ÇÑ ", TIME_LIMIT, "ÃÊ");
                
                do {            // ¼±¼ö°¡ »ç°ÝÀ» ÇÒ ¶§±îÁö Å° ÀÔ·ÂÀ» ±â´Ù¸°´Ù.
                        num = getch() - '0';
                        if (num >= 1 && num <= 9) {
                                ShootArrow(num);
                                shot_fired = true;
                        }
                } while (!shot_fired);  
                
                // ½Ã°£ ¾È¿¡(2ÃÊ) Ÿ°ÙÀ» ¸ÂÃß¾úÀ» ¶§ ½ÇÇàµÈ´Ù.
                if ((time(NULL) < start_time + TIME_LIMIT) && num == target_position) {  
                        putchar('\a');
                        ++score;
                }
                EraseTarget(target_position);
        }
        return score;
}

void ShootArrow(int a) {   // ÆĶó¹ÌÅÍ a´Â ¹ß»çÇÑ È­»ìÀÇ ¹øÈ£
        int x;
        long delay;
        for (x = 4; x <= 60; x++) {
                gotoxy(x, a * 2 + 3);     // ·çÇÁÀÇ ¸Å ȸ¸¶´Ù È­»ìÀ» 1¹®ÀÚ¾¿ ¿À¸¥ÂÊÀ¸·Î ¿òÁ÷ÀδÙ.
                printf(">>-->");
                for (delay = 0; delay < 3999999; delay++)  // ÀÌ ÄÚµå·Î È­»ìÀÇ ¼ÓµµÁ¶ÀýÀ» ÇÑ´Ù. ½Ã½ºÅÛÀÇ ¼º´É¿¡ µû¶ó ´Ù¸£´Ù.
                        continue;
                gotoxy(x, a * 2 + 3);
                printf("     ");
        }
        gotoxy(4, a * 2 + 3);
        printf(">>-->");
}

void ShowScore(int score) {
        gotoxy(60, 20);
        printf("-----------------");
        gotoxy(60, 21);
        printf("%s%d", " Your score is ", score);
        gotoxy(60, 22);
        printf("-----------------");
}

int ShowTarget(void) {
        int p = rand() % 9 + 1;         // ÀÌ ³­¼ö´Â Ÿ°ÙÀÌ ³ªÅ¸³¯ ·¹ÀιøÈ£ÀÌ´Ù. 1 ~ 9
        gotoxy(60, p * 2 + 3);
        printf("X");
        return p;
}

  Hit : 17162     Date : 2008/01/15 07:29



    
aloe ¿ì¿Í!! ´ë´ÜÇϽôÙ.. ÀÌ°ÅÀúµµ Ç÷¹ÀÌÇغ¸°í½ÍÀºµ¥ ¾î¶±ÇØÇϳª¿ä? 2008/01/15  
whqkdnf000 ÄÄÆÄÀÏÇؼ­ ÇϽôø°¡, ÄÄÆÄÀÏ·¯ ¾øÀ¸¸é ÇØÄð ftz¿¡¼­ ÄÄÆÄÀÏÇؼ­ ¾²½Ã¸é ‰Ï´Ï´Ù^-. 2008/01/16  
k1rha ÄÄÆÄÀÏÈÄ ½ÇÇàÇÏ·Á´Ï ¿¡·¯°¡ 3°³¶ß³×¿ä 2008/01/16  
whqkdnf000 ¾Æ¸¶ Çì´õÆÄÀÏÀÌ ¾ø¾î¼­ ±×·±°Í°°Àºµ¥¿ä. º¼·£µåC¿¡¼­´Â ÄÄÆÄÀÏÀ߉ϴϴÙ., 2008/01/16  
qkreoghks00 À©µµ¿ì¿ë gcc¿¡¼­´Â ¾ÈµÇ³ª¿ä? (¾ÆÁ÷¾ÈÇغÃÀ½) 2008/01/23  
lvson1004 ºñÁê¾ó½ºÆ©µð¿À·Î µ¹·Áº¸´Ï ¾ÈµÇ³×¿ä ¤Ð¤Ð 2008/02/22  
marin5318 Åͺ¸¿¡¼­ ¾ÈµÅ³×¿ä.......¤Ð¤Ð 2008/03/24  
flsnrtm º¼·£µåC·Î ¾î¶»°Ô ÄÄÆÄÀÏÇØ¿ä? 2008/04/18  
Min-Q ÄÄÆÄÀÏ ¿¡·¯³ª¸é gotoxyÇÔ¼ö¸¦ ¸¸µé¾îÁÖ½Ã¸é µÇ¿ä 2008/04/29
Min-Q ÇÔ¼ö º»Ã¼´Â ³×À̹ö¿¡¼­ gotoxy °Ë»öÇÏ½Ã¸é ¸¹ÀÌ ³ª¿Â´ä´Ï´Ù. 2008/04/29
ahdudqh ¾î¸Ó¸Ó ¤» ¯À̽ó׿© 2008/08/22  
lit02 À©µµ¿ìgcc¾ÈµÅ 2009/05/24  
Àܵ¥½º ¤§¤§ 2024/03/06  
     [°øÁö] °­Á¸¦ ¿Ã¸®½Ç ¶§´Â ¸»¸Ó¸®¸¦ ´Þ¾ÆÁÖ¼¼¿ä^¤Ñ^ [29] ¸Û¸Û 02/27 19450
1595   [pwnable.kr] Shellshock[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 96
1594   ShellshockÀÇ ±âº» ¿ä¾à     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 77
1593   [pwnable.kr] fd     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 70
1592   VPNÀÌ ¿¬°áµÇ¾ú´Ù°¡ µµÁß¿¡ ²¨µµ À¥ ºê¶ó¿ìÀú»ó¿¡¼­ À¯ÁöµÇ´Â ÀÌÀ¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 77
1591   ÇØÄ¿µéÀÌ ÇØÅ·½Ã »ç¿ëÇÏ´Â µð·ºÅ丮 °ø°£[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 116
1590   Keyboard Hooking -part2 - (Python3 ver)     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 86
1589   [Windows API] Keyboard Hooking     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 74
1588   [pwnable.kr] cmd1 °ø·«     ÇØÅ·ÀßÇÏ°í½Í´Ù
10/23 238
1587   netdiscover ÆÄÀ̽ãÀ¸·Î ±¸ÇöÇϱ⠠   ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 515
1586   ÆÄÀ̽ãÀ» ÀÌ¿ëÇÑ ½ÉÇà À¥ Å©·Ñ·¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 407
1585   ÆÄÀ̽ã random¸ðµâÀ» ÀÌ¿ëÇÑ ¼ýÀÚ¸ÂÃ߱⠰ÔÀÓ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/30 957
1584   ÆÄÀ̽ã äÆà ÇÁ·Î±×·¥ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/28 847
1583   ÆÄÀ̽㠼ÒÄÏ ÇÁ·Î±×·¡¹ÖÀÇ ±âÃÊ     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/26 987
1582   ¸®´ª½º À¥ ·Î±× ºÐ¼®     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/20 675
1581   ¸®´ª½º/À©µµ¿ì º¸¾È Àåºñ ·Î±×     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/20 826
1580   °í¼ö´ÔµéÀÇ µµ¿òÀ» ¹Þ°í ½Í½À´Ï´Ù     vbnm111
02/11 914
1579   ¸®´ª½º Ä¿³Î 2.6 ¹öÀü ÀÌÈÄÀÇ LKM     jdo
07/25 1432
1578   ½©ÄÚµå ¸ðÀ½     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/15 2308
1577   Call by value VS Call by Reference     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/15 1608
1 [2][3][4][5][6][7][8][9][10]..[80]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org