U E D R , A S I H C RSS

RUR-PLE/Etc

1. RUR-PLE/Etc

  • Ÿฌํ”Œ˜ ‚˜จธ€ ˜ˆ œ“ค..

1.1. Harvest

  • harvest1.wld ›”“œ ํŒŒ„ —ฐ‹ค.
  • ํ˜„žฌ €„— žˆŠ” ชจ“  ”จ•—„ ˆ˜ํ™•ํ•˜Š” กœง„ ง ‹ค.


~cpp 
def move_and_pick():
    move()
    if next_to_a_beeper():
      pick_beeper()

def upAndTurnLeft():
    turn_left()
    move()
    pick_beeper()
    turn_left()   
 
def upAndTurnRight():
    turn_left()
    turn_left()
    turn_left()
    move()
    turn_left()
    turn_left()
    turn_left()

def harvestTwoRow():
    repeat(move_and_pick,6)
    upAndTurnLeft()
    repeat(move_and_pick,6)
    upAndTurnRight()

repeat(harvestTwoRow,3)
turn_off()

1.2. „ ํƒ  Harvest

  • harvest2.wld ›”“œ ํŒŒ„ —ฐ‹ค.
  • ํ˜„žฌ 2ฐœธ ”จ•—„ „ž—ฌ žˆ‹ค. ชจ“  ฐญ— 1ฐœธ ”จ•—งŒ žˆฒŒ งŒ“ ‹ค.

~cpp 
next_to_a_carrot=next_to_a_beeper
plant_carrot = put_beeper
pick_carrot = pick_beeper

def pick_TwoCarrot():
    if next_to_a_carrot():
        pick_carrot()
        if not next_to_a_carrot():
            plant_carrot()

def one_carrot_only():
    if not next_to_a_carrot():
        plant_carrot()

def move_and_pick():
    if front_is_clear():
       move()
       pick_TwoCarrot()
    else:
        upAndTurnLeft()

def move_and_put():
    move()
    one_carrot_only()

def upAndTurnLeft():
    turn_left()
    move()
    pick_beeper()
    turn_left()    

def upAndTurnRight():
    turn_left()
    turn_left()
    turn_left()
    move()
    turn_left()
    turn_left()
    turn_left()
downAndTurnRight = upAndTurnLeft
downAndTurnLeft = upAndTurnRight 
def harvestTwoRow():
    repeat(move_and_pick,6)
    repeat(move_and_pick,6)

repeat(harvestTwoRow,1)
upAndTurnRight()
repeat(move_and_pick,6)
repeat(move_and_pick,5)
upAndTurnRight()
repeat(move_and_pick,6)
repeat(move_and_pick,5)

one_carrot_only()
turn_left()
turn_left()
repeat(move_and_put,5)
downAndTurnLeft()
one_carrot_only()
repeat(move_and_put,5)
downAndTurnRight()
one_carrot_only()
repeat(move_and_put,5)
downAndTurnLeft()
one_carrot_only()
repeat(move_and_put,5)
downAndTurnRight()
one_carrot_only()
repeat(move_and_put,5)
downAndTurnLeft()
repeat(move_and_put,5)
turn_off()


1.3. ž„˜˜ ฐœˆ˜ ”จ ฒ˜ฆฌํ•˜Š” Harvest

  • harvest3.wld ›”“œ ํŒŒ„ —ฐ‹ค.
  • ํ˜„žฌ 2ฐœ ดƒธ ”จ•—ด ฐญ— žˆ‹ค. ชจ‘ 1ฐœธ ”จ•—งŒ žˆฒŒ งŒ“ ‹ค.
  • ด ฒฝšฐ—„œ˜ ฒ˜ฆฌ while ฌธ„ ‚ฌšฉํ•˜—ฌ ฒ˜ฆฌํ•œ‹ค.

~cpp 
next_to_a_carrot=next_to_a_beeper
plant_carrot = put_beeper
pick_carrot = pick_beeper
def upAndTurnLeft():
    turn_left()
    move()
    pick_beeper()
    turn_left()    

def upAndTurnRight():
    turn_left()
    turn_left()
    turn_left()
    move()
    turn_left()
    turn_left()
    turn_left()
downAndTurnRight = upAndTurnLeft
downAndTurnLeft = upAndTurnRight 
def pick_TwoCarrot():
    if next_to_a_carrot():
       while next_to_a_carrot():
           pick_carrot()
       if not next_to_a_carrot():
           plant_carrot()

def one_carrot_only():
    if not next_to_a_carrot():
        plant_carrot()

def move_and_pick():
    if front_is_clear():
       move()
       pick_TwoCarrot()
    else:
        upAndTurnLeft()

def move_and_put():
    if front_is_clear():
       move()
       one_carrot_only()
    else:
        downAndTurnLeft()


def harvestTwoRow():
    repeat(move_and_pick,6)
    repeat(move_and_pick,6)

repeat(harvestTwoRow,1)
upAndTurnRight()
repeat(move_and_pick,6)
repeat(move_and_pick,5)
upAndTurnRight()
repeat(move_and_pick,6)
repeat(move_and_pick,5)

one_carrot_only()
turn_left()
turn_left()
repeat(move_and_put,6)
one_carrot_only()
repeat(move_and_put,5)
downAndTurnRight()
one_carrot_only()
repeat(move_and_put,6)
one_carrot_only()
repeat(move_and_put,5)
downAndTurnRight()
one_carrot_only()
repeat(move_and_put,6)
one_carrot_only()
repeat(move_and_put,5)
turn_off()

1.4. Amazing Part 1

  • amazing1.wld ›”“œ ํŒŒ„ —ฐ‹ค.
  • ํ˜„žฌ ›”“œ ํ•œฐ”€ „Š” กœง„ งŒ“ ‹ค.

{{{~cpp 
put_beeper()
while not next_to_a_beeper():
    if front_is_clear():
        move()
    else:
        turn_left()

turn_off()
== Amazing Part 2 ==
 *  amazing2.wld ›”“œ ํŒŒ„ —ฐ‹ค.
 * ํ˜„žฌ ›”“œ ํ•œฐ”€ „Š” กœง„ งŒ“ ‹ค.
{{{~cpp 
def turn_right():
    repeat(turn_left, 3)
put_beeper()
move()
while not next_to_a_beeper():
    if right_is_clear():
        turn_right()
        move()
    elif front_is_clear():
        move()
    else:
        turn_left()

turn_off()
}}}


== Amazing Part 3,4 ==
 *  amazing3.wld ›”“œ ํŒŒ„ —ฐ‹ค.
 * ํ˜„žฌ ›”“œ ํ•œฐ”€ „Š” กœง„ งŒ“ ‹ค.
{{{~cpp 
def turn_right():
    repeat(turn_left,3)
put_beeper()
if front_is_clear():
    move()
else:
    turn_left()
    if front_is_clear():
        move()
    else:
        turn_left()
        move()
while not next_to_a_beeper():
    if front_is_clear():
        if right_is_clear():
            turn_right()
            move()
        else:
            move()
    else:
        turn_left()
turn_off()
}}}
== Amazing Part 5 ==
 *  amazing5.wld ›”“œ ํŒŒ„ —ฐ‹ค.
 * ํ˜„žฌ ›”“œ ํ•œฐ”€ „Š” กœง„ งŒ“ ‹ค.
{{{~cpp 
def turn_right():
    repeat(turn_left,3)

if front_is_clear():
    move()
else:
    turn_left()
    if front_is_clear():
        move()
    else:
        turn_left()
        move()
while not next_to_a_beeper():
    if right_is_clear():
        turn_right()
        move()
    elif front_is_clear():
        move()
    else:
        turn_left()
turn_off()
}}}

== ด œ งŒ“  amazing„ จ–ด ณดž ==
 * hurdle3.wld ›”“œ ํŒŒ„ —ด–ด„œ Œ คณดž.(ฒ˜Œ˜ put_beeper()Š” •ํ•จ)
 * maze1.wld ›”“œ ํŒŒ„ —ด–ด„œ Œ คณดž.
 * amazing„ ํ•ดณดฉด„œ Š‚€ „ ฐž ด•ธฐ ํ•ดด…‹œ‹ค~!

== rain1 ==
 * rain1.wld ›”“œ ํŒŒ„ —ฐ‹ค.
 * ฒ˜Œ ‹œž‘ํ•œ ฐฝฌธ งณ  ‚˜จธ€ ฐฝฌธ“ค„ beeper •ž— ‘Š” ‹œกœ ํ•ด„œ ‹ซŠ”‹ค. กœด‡€ ฒ˜Œ ‹œž‘ํ•˜Š” ฐฝฌธœกœ ˜จ‹คŒ— ทธ ฐฝฌธ„ ฐ”ณด•„• ํ•œ‹ค. ‹œž‘‹œ— กœด‡€ beeper ถฉ„ํžˆ €€ณ  žˆ‹ค.
{{{~cpp 
def turn_right():
    repeat(turn_left,3)
move()
put_beeper()
turn_left()
move()
def close_window():
    if not front_is_clear():
        turn_right()
    elif left_is_clear():
        put_beeper()
        move()
    else:
        move()

def turn_around():
    while not next_to_a_beeper():
        close_window()
    pick_beeper()
    turn_left()
turn_around()
turn_off()
}}}
== rain2 ==
 * rain2.wld ›”“œ ํŒŒ„ —ฐ‹ค. rain1 € ‹คฅดฒŒ ƒ‹ค.
 * rain1˜ ฝ”“œ —ฌธฐ„œ„ Œ•„€„ก งŒ“ ‹ค.
{{{~cpp 
def turn_right():
    repeat(turn_left,3)
def turn_back():
    repeat(turn_left,2)
move()
put_beeper()
turn_left()
move()
def close_window():
    if not front_is_clear():
        turn_right()
    elif left_is_clear():
        put_beeper()
        move()
        if left_is_clear():
            turn_back()
            move()
            pick_beeper()
            turn_right()
            move()
    else:
        move()

def turn_around():
    while not next_to_a_beeper():
        close_window()
    pick_beeper()
    turn_left()
turn_around()
turn_off()
}}}
== trash1 ==
 * trash1.wld ›”“œ ํŒŒ„ —ฐ‹ค. 
 * —ฌธฐ žˆŠ” beeper“ค„ ชจ‘ ชจ•„€€ณ  ™ชฝ œ„ ตฌ„— ชจ‘ ชจ€‹ค.‹ค ชจ€ํ›„ ‹œž‘ํ• •Œ˜ œ„˜—„œ ทธ ž„กœ žˆŠ”‹ค.
{{{~cpp 
def turn_back():
    repeat(turn_left,2)
def turn_right():
    repeat(turn_left,3)
def go_to_garbage():
    turn_back()
    while front_is_clear():
        move()
    turn_right()
    move()
    put_beeper()
    turn_back()
    move()
    turn_left()

while front_is_clear():
    move()
    if next_to_a_beeper():
        pick_beeper()
        go_to_garbage()
turn_back()
while front_is_clear():
    move()
turn_back()
turn_off()
}}}
== trash2 ==
 * trash2.wld ํŒŒ„ —ฐ‹ค. trash1—„œ ž‘„ํ•œ กœงด —ฌธฐ„œ„ Œ•„€• ํ•œ‹ค.
----
[RUR-PLE]
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:27:49
Processing time 0.0132 sec