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]