////////////////////////////////////////////////////////////////////

ȳϼ! Ͽ. ̹´ ª   ¸  

 մϴ. ̹´ ׸ ߿ ´ ƴϴϱ,   

  ׿.

׷ ¸ մϴ.

////////////////////////////////////////////////////////////////////

[ ġ ]

for(i=0;i<rock;i++) {
    y=random(22);
    x=random(78);
    ground[y+1][x+1]=12;
}

 ground迭 ֹ   Խϴ. ܿ ݺ  ֳ

..-_-;;  ׷ ҽ..

켱, ǹ.

(i=0;i<rock;i++)

rock     ϴ Դϴ. ̷  .

"? rock   𸣴µ?"

Ͻø鼭  Ͻǲ,  ñ..

ũ ҽ 캸ø   ߰Ҽ ̴ϴ.

rock=20+(level*7);

!  level̶ ο  ֱ..

level  Ǽ Ǿֽϴ.    2°

̸ 2 Ǿ ְ? ׷  ô.

rock=20+(2*7);
    =20+14;
    =34;

, 2°    34 ˴ϴ.

׷ ǹ ư..

for(i=0;i<rock;i++) {
    y=random(22);
    x=random(78);
    ground[y+1][x+1]=12;
}

 ݺ 34 ݺϰ Ǵµ. ݺȿ 츮 ˰ִ random()

  !

y=random(22);
x=random(78);
ground[y+1][x+1]=12;

random()Լ 0~(-1)  ȯѴٰ ? ׷  

 ǰڱ.. (random(22) 12 ȯϰ, random(78) 48 ȯߴ

 .)

y=12;
x=48;

װ , ؿ Ŀ ϸ,

 ground[12+1][48+1]=12;
=ground[13][49]=12;
                      y  x
, ground迭 ǥ(13,49) ִ ҿ 12 Ӽ ϰ 

ϴ. ׷  ȯ 1 ұ? е

"ȭ鿡 ǥҷ  ϴ° ƴұ?"

ϰ ϼ̰, װ ƴմϴ. 켱 ȯ  ?

random(22) ȯ 0~21 ̰?

, random(78) ȯ 0~77 ̰?

⿡ 1 ϸ..

y  1~22, x  1~78 ̰ . ?    

ܵ? ׷ϴ.

 |-----------[0~79]-------------|
 | |---------[1~78]-----------| |
+--------------------------------+
||----------
||--       |
|| |       |
|| |[1~22] |[0~23]
|| |       |
||--       |
||----------
+--------------------------------+

 ¿  Ҷ  ׸ ?  y,x 

   ?     ҽ ִ ġȯ 

ϸ..

ground[1~22][1~78]=12;

 ƽð?

   ־ Ұ ȭ׵θھ ϴ Դϴ.

 ǥ random()Լ ȯ   ˴ϴ.

..  κ Ѿ µ..  Ŀ ణ  

? Ӹ    ġä..

 ҽ   ιϴ    .. ..  

  ߰ Ŷ..-_-;; ҽ  ٵ.. ..

׷  ׷   ..

켱 ȹ ô.

켱.. random()Լ ȯ  ġ ..  ġ ִ

Ӽ  Ӽ(12)  ˾ƺ ǰ? ׷ ҽ..

for(i=0;i<rock;) {
    y=random(22);
    x=random(78);
    if(!(ground[y+1][x+1]==12) ) {
        ground[y+1][x+1]=12;
        i++;
    }
}

¥~ ̰  ׸  ҽԴϴ.

׷.  մϴ~

켱 κ ?(for(i=0;i<rock;̺κ.)) ׸.. ġȯ

 ִ ǹ ̱.. ǽ ?

!(ground[y+1][x+1]==12)

.. 켱 ȣ ĺ  սô.

ground[y+1][x+1]==12

   Ǯ..

  ǥ ִ 迭 ҿ  ִ Ӽ 12( 

) ˾ƺ ε.. ࿡ ҿ ִ Ӽ 12 Ʋ(

Ѹ   )   ǰ 0 ȯǴµ.. ׷

  ?

!0

! '!'ڰ ֱ! ׷ٸ ǽ   ٲϴ.

ٽ ҽ ?

for(i=0;i<rock;) {
    y=random(22);
    x=random(78);
    if(!(ground[y+1][x+1]==12) ) {
        ground[y+1][x+1]=12;
        i++;
    }
}

ǿ  (    .) װ  

 ġȯϰ(ground[y+1][x+1]=12;) i ŵϴ. ׷ٸ 

 ġ  ִٸ(, ground[y+1][x+1]==12  ɰ.)

 ?

!1

̹ '!'ڿ  ǽ   ٲϴ.

ǽĿ ɸ if  ʰ, i  Ƿ ξƹŸ

 ˴ϴ. ^^;; ׷ ٽ ó   ġ  ް

ٽ ǽ ϴ. ̶  ϸ, i ǰ,  ׷鼭

ground迭  ٸ   Ӽ (ġȯ)˴ϴ.

ϼ̳? ذ ʰŴٸ    ʽÿ.  

   Ƿ.. ׷   . Ĵٴ~

////////////////////////////////////////////////////////////////////

[ ġ ]

for(i=0;i<tree;) {
    y=random(22);
    x=random(78);
    if(!(ground[y+1][x+1]==12)) {
        ground[y+1][x+1]=3;
        i++;
    }
}

 ҽ ground迭  ġ ϴ ҽε, Ʊ  ҽ

ϰ ( .)?

 ġ ϴ  ġ ϴ  Ƿ 

 ǹκ  ϰڽϴ.

, ,    ϴ  ˷߰ڱ.. ؿ..

tree=10+(level*3);

 İ ġ   оø ġϴ 

 ˼ ̴ϴ. ׷ ǹ ϰڽϴ.

for(i=0;i<tree;) {
    y=random(22);
    x=random(78);
    if(!(ground[y+1][x+1]==12)) {
        ground[y+1][x+1]=3;
        i++;
    }
}

켱 ó   Ҷ i 0Դϴ.  ġ ް, 

ǹ ϴ. ̶  ϸ, ground迭  Ӽ 

ǰ, i  ˴ϴ. ,   ϸ i 

ʰ ٽ  ġ  ǹ ϴ.  ڸ,

 л  θ ϰ ִٰ սô.   θ ׸Ϸ

, ԿԼ  (tree) ޾ƾ Ѵٰ սô. л 

 Ǯ (random()   ġ)  (ǹ)

 ϴ. ̶ ˻()   л (i) 1

ݴϴ.(i++) , ̶ ˻()   ٽ  Ǯ

ٽ   Կ  ̷  (i) (tree) 

 ݺմϴ. ׸ ħ (i) (tree)  ׶

 μ   Դϴ.

ذ̳? ʰ̴ٸ..-_-;; ..

׸  κп װ ִµ..     ִ 

ϰ  ִ ˻ ʴ´ٴ Դϴ. -_-;; ,

Ʒ  ġ ˴ϴ.

for(i=0;i<tree;) {
    y=random(22);
    x=random(78);
    if(!(ground[y+1][x+1]==12 || ground[y+1][x+1]==3)) {
        ground[y+1][x+1]=3;
        i++;
    }
}

̰....  ʾƵ ƽð?

..𸥴ٱ..-_-;; 𸣰ڴٴ  ..

////////////////////////////////////////////////////////////////////

[ڵ ġ ]

for(i=21;i<30;) {
    y=random(23);
    x=random(79);
    if(!((ground[y+1][x+1]>10) || (ground[y+1][x+1]==3))) {
        ground[y+1][x+1]=i;
        i++;
    }
}

.. ̰͵ 2 ҽ ѵ..  ϰڽϴ. 켱. i..

i ó 21 ġȯ˴ϴ. ׷ 21 29 Ƕ, ݺ 

9 ݺϰ ˴ϴ.  ǹ  ٲµ..  ڸ..

  ġ , , ڰ ִ ˾ƺ, ֹ ִ

, ٽ ο ġ ް ǹ ɴϴ. , ֹ 

ٸ,  ġ  Ӽ ϰ i  Ű ˴ϴ.

⼭ ̷ο , Ź 迭 Ǵ Ӽ Ʋٴ Դϴ.

, ground[y+1][x+1]=i ̷   ġȯ ʰ, i 

 ġȯ()Ǵµ,   ߿  ̵Ұ  ִ 

  ڰ ,  ´  ˱ ؼ  ڵ

 Ӽ Ʋ ϱ⶧Դϴ.

صǼ?

׸.. ⿡ װ..(Ȱ͸ 3°..-_-;;) ̹  

,  ִ ˻ϸ鼭 ڰ ִ ˻ ʴ´ٴ..-_-;

Ʒ  ġ ׸  ֽϴ.

for(i=21;i<30;) {
    y=random(23);
    x=random(79);
    if(!((ground[y+1][x+1]>10) || (ground[y+1][x+1]==3) || (ground[y+1][x+1]<30))) {
        ground[y+1][x+1]=i;
        i++;
    }
}

 8  ϸ鼭   ˾Ҵµ..-_-;;

׷  ~ ***********<>>==-  <-̻.

////////////////////////////////////////////////////////////////////

[Ÿġ]

ground[4][0]=20;
ground[19][79]=31;
ground[4][1]=15;
ground[4][2]=10;
ground[4][3]=10;
ground[4][4]=10;
ground[19][78]=10;
ground[19][77]=10;
ground[19][76]=10;

 ҽ.. 1°  ġ ϴ κ̰,

2°  Żġ ϴ κ̰,

3°  첿ġ ϴ κ̰,

4~6°  ۽ տ ִ ֹ ϴ κԴϴ.

7~9°  ۽ Żտ ִ ֹ ϴ κԴϴ.

 κп     ġڽϴ.   

Ҽ ְ?

 κп ʿ κ ִµ.. װ ߿  ð 

 ҽ ¸ ϰڽϴ.

////////////////////////////////////////////////////////////////////
[ȭ鿡  ǥ]

for(gy=0;gy<24;gy++) {
    for(gx=0;gx<80;gx++) {
        gotoxy(gx+1,gy+1);
        if(ground[gy][gx]==15) cprintf("O");
        else if(ground[gy][gx]==10) cprintf(" ");
        else if(ground[gy][gx]==11) cprintf("");
        else if(ground[gy][gx]==12) cprintf("*");
        else if(ground[gy][gx]==3) cprintf("Y");
        else if(ground[gy][gx]==20) cprintf("S");
        else if(ground[gy][gx]==31) cprintf("E");
        else if(ground[gy][gx]>20 && ground[gy][gx]<30) {
        textcolor(2);
        cprintf("%d",(ground[gy][gx]-20));
        textcolor(7);
        }
    }
}

ȭ鿡  ǥϴ , ground迭 Ǿִ ǥ 

 ʸ ʸǾƷ о鼭  Ӽ ´ 

 ȭ鿡 ǥմϴ.

ó..  ݺ ?  ιݺ ground迭  

 ϴ.

for(gy=0;gy<24;gy++)
for(gx=0;gx<80;gx++)

׸ ״..

gotoxy(gx+1,gy+1);

 κ  а ִ ground迭 ǥ شϴ ȭǥ Ŀ

̵ŵϴ.

 ..

if(ground[gy][gx]==15) cprintf("O");
else if(ground[gy][gx]==10) cprintf(" ");
else if(ground[gy][gx]==11) cprintf(""); <-̰ ..
else if(ground[gy][gx]==12) cprintf("*");
else if(ground[gy][gx]==3) cprintf("Y");
else if(ground[gy][gx]==20) cprintf("S");
else if(ground[gy][gx]==31) cprintf("E");
else if(ground[gy][gx]>20 && ground[gy][gx]<30) {
        textcolor(2);
        cprintf("%d",(ground[gy][gx]-20));
        textcolor(7);
     }

 κ ground迭 ǥ ִ ҿ ִ Ӽ  

´ ڸ ȭ鿡 ǥϴ κԴϴ.

 κи ϰڽϴ.

textcolor(2);
cprintf("%d",(ground[gy][gx]-20));
textcolor(7);

textcolor(2); ̷ ϸ ȭ鿡 ǥõǴ   ʷϻ 

մϴ.

cprintf("%d",(ground[gy][gx]-20));

̺κ Ʊ ڿ  Ӽ 20   ȭ鿡 մϴ.

  21 , 1 ȭ鿡 ϰ ˴ϴ.

textcolor(7); ̷ ϸ ȭ鿡 ǥõǴ   ȸ(

ڻ) մϴ.

////////////////////////////////////////////////////////////////////

~ ̹µ ! ʹ 鱺.. Ϸ ǻ;տ ־..

 .. ´  ʰ øڽϴ. ׵  Ͻñ

 ʵǴ   ..

׷ ̸..

////////////////////////////////////////////////////////////////////
