The Stanford Python Karel guide contains a total of 11 chapters. The first 8 chapters include a puzzle that the student can attempt to solve by programming Karel. There are chapter data files included in the project code for all of the puzzles covered by those 8 chapters. The last few chapters contain extra features, an API reference, and a page that lets you code Karel live in the browser. They do not contain puzzles to be completed, but are still worth taking a look at.
The puzzles on this page are intended for you to do while you read the information presented in each chapter within the Stanford Python Karel guide. Load that guide in a browser tab and read through it as you work on the puzzles.Â
Chapter 1
Load this puzzle from the file chapters/karel_ch01.json. Your goal is to program Karel to pick up the beeper and walk up and around the obstruction in a U-turn shape, then put the beeper back down.
Chapter 2
Load this puzzle from the file chapters/karel_ch02.json. Your goal is to program Karel to pick up the beeper and walk up onto the hill, place the beeper back down, and take another step forward to the last available corner.Â
Chapter 3a
Load this puzzle from the file chapters/karel_ch03a.json. Your goal is the same as the puzzle from Chapter 2, but you're intended to declare your own new function turn_right()
in order to solve it this time.
Initial state and goal state are the same as depicted above.
Chapter3b
Load this puzzle from the file chapters/karel_ch03b.json. Your goal is to go around the wall and pick up the beeper. Then take the beeper to the opposite corner of the world and place it back down. Karel should remain at the same location as the beeper, and face west. This is a custom puzzle I created; it isn't included in the Stanford Chapter 3 page.Â
Chapter 4
Load this puzzle from the file chapters/karel_ch04.json. Your goal is to fill the pothole by placing a beeper inside of it, then move Karel to the opposite side of the filled hole. Think about ways to break the challenge down into smaller components and then try to declare functions to carry out the tasks required by them.Â
Chapter 5a
Load this puzzle from the file chapters/karel_ch05a.json. Your goal is to use a for
loop to put down 42 beepers and then move Karel one step past them.
Chapter 5b
Load this puzzle from the file chapters/karel_ch05b.json. Your goal is to place one beeper in each of the 4 corners of the world. Karel should end at the same location, and facing the same direction it was when it began.
Chapter 5c
Load this puzzle from the file chapters/karel_ch05c.json. Your goal is to place 5 beepers in each of the corners of the world. Try to declare a new function or two that make use of for
loops inside of them to solve this puzzle.
Chapter 6a
Load this puzzle from the file chapters/karel_ch06a.json. Your goal is to move Karel forward as long as there is an empty space in front. Learn about, and use a while
loop to solve this puzzle.Â
Chapter 6b
Load this puzzle from the file chapters/karel_ch06b.json. Your goal is similar to the previous puzzle, but this time leave a trail of beepers on the ground at each location that Karel moves to. Solving this puzzle requires dealing with the fencepost bug.
Chapter 7
Load this puzzle from the file chapters/karel_ch07.json. Your goal is walk to the end of the row, inverting the beeper presence along the way. Any tile that was empty should have a beeper put down, and any tile that had a beeper already should have the beeper picked up, and be left empty. Learn about if
statements and basic conditional to solve this puzzle.Â
Chapter 8
Load this puzzle from the file chapters/karel_ch08.json. Your goal is to move Karel along the bottom row, stopping to pick up the entire column of beepers that are present and then moving to the next column. Once all beepers are collected, put them down in the bottom right corner of the world. Finally, return Karel to the starting location and direction. This puzzle requires combining together knowledge from all of the previous chapters.Â
Page last edited December 18, 2024
Text editor powered by tinymce.