2. RUR-PLE 란 ? ¶
- 로그래밍 를 배는것 밌 다는 만들 경다. 로 보면 밌다. 많 된다.
- Python 를 로그래밍 를 배 는 경다.
- Python 문법 기반만, 몰라 관다. 들 가고 결 나가기 때문다. 변 다.
- 로 로봇 로그래밍 그 로봇 로그래밍 는데로 는것 보면 말 겠만 되는 만 -_-; 면로나 그 로봇 는 것 보면 로그래밍 볼 다. 기 는 드들 무 모가 까 기 겠만, 로봇 동 로그래밍 는다면 기 는 방과 게 것다.(드로 복것 명령로 다 그 명령 게 복로 는 동 로봇 게 만드는 로..) 말그대로 로봇 로그래밍 로나 볼 다.
4.1. 로봇 볼까? ¶
- Robot: Code and Learn 다.
- 드 는 면 래 같 드를 본다.
~cpp move() turn_off()
- 그 면 Mp3 Play 게 긴 릭다.
- 라는 나면 test 라고 고 다.
- 그리고 다 play 른다.
4.3. (beeper) 기기 ¶
- beeper를 겨 보.
- beeper를 드는 명령 : pick_beeper()
- beeper를 내려 놓는 명령 : put_beeper()
- beepers1.wld 다.
- 래 그림과 같 는 드를 본다.
4.4. 디깅 방법? ¶
- RUR-PLE 디깅 다.
- Play Play 모과 대기 나 는것 step into 다. 명령가 나 된다. 되고 는 명령는 드 부 로 highlighting 된다.
- Play 릭고 나 로봇 고 는 는 step into (play 는) 릭면 그 부 명령가 나 나 된다.
- step into 는
- 그 는 빨 료
4.6. 복 기 ¶
- 래 같 def 를 를 다.
- repeat 명령를 러 는 (명령 ) 방복 만 다.
~cpp def turn_right(): repeat(turn_left, 3)
- 벽 만들기 드들 복 를 다.
4.7. if 문 ¶
- next_to_a_beeper() : beeper가 로봇 리 면 true, 면 false를 반다.
~cpp if next_to_a_beeper(): pick_beeper()
- if문과 , repeat를 래 면과 같 리다.
4.7.1. else 문 ¶
- front_is_clear() : 로봇 벽 면 true, 면 false
- left_is_clear() : 로봇 벽 는 검
- right_is_clear() : 로봇 른 벽 는 검
- else 문 래 드럼 다.
~cpp def move_or_turn(): if front_is_clear(): move() else: turn_left()
- 그래 그림럼 로봇 방 바돌게 보. 방 기 따라 반복 를 다르게 다. 기가 5라면 5*4=20 런로..
4.8.1. ¶
- 래 그림럼 만든다.
- 문 래 같 를 고 라고 다. 는 다르게 다. 고는 고..
~cpp # introducing vocabulary related to the problem next_to_a_carrot = next_to_a_beeper plant_carrot = put_beeper pick_carrot = pick_beeper def one_carrot_only(): if not next_to_a_carrot(): plant_carrot() # replace missing seed else: pick_carrot() if not next_to_a_carrot(): # oops! plant_carrot() # we had removed the only one
4.9. while ¶
- 래 같 로 다.
~cpp next_to_a_carrot = next_to_a_beeper plant_carrot = put_beeper pick_carrot = pick_beeper def one_carrot_only(): while next_to_a_carrot(): pick_carrot() # pick them all! plant_carrot() # replant only one
- harvest3.wld 다.
- while문 복된 개가 2 개 경 리 가능게 를 다.
4.10. Amazing Part ¶
- 말 내다. 단 몇가 결면 놀라 기능 되는것 볼 다.
- sorting 문를 고나 남 보길. 러 Amazing 명
4.11. Sorting ¶
- sort0_1.wld 다.
- 들 그림럼 로 로봇 렬게 만들면 된다.
- 래는 단게 2개 column 경 렬 모다.
- 다 sort0_2.wld 다.
- 래 그림과 같 래 렬되 는 경 대로 동되는 본다.
- sort1 다.
- 래 그림과 같 더 복 러개 column 동 다.
- sort2 는 공개
5. 경 ¶
- sort1, sort2 맵 가 먼 모두 로 렬는 게 데블/2005/RUR-PLE/경 드립다.
- 05 군 가 먼 sorting 결 경 다. 01 김 sort2 맵 대 결만 sort1 대는 부로 결다.
데블2005/RUR_PLE/