-
Notifications
You must be signed in to change notification settings - Fork 1
Karel Accessibility
Karel is a graphical program and therefore needs a few accessibility features to make it useful to all students.
If you would like to view Karel's world in a spreadsheet instead of an image (which may be helpful for screen-reader users), add the following line to main.cc between LoadWorld and KarelProgram:
EnableCSVOutput();This will generate a file, karel.csv, which is a representation of Karel's world in spreadsheet form. Karel will wait for you to enter any character on the command line to take the next action, and each time it takes an action it will update karel.csv. There is a key within the spreadsheet explaining how to interpret it.
Below is an example of screenshot and karel.csv for a 3x3 world where karel is on cell (1, 1) facing east, there is a beeper at cell (3, 3), and there are walls between cells (1, 1) and (2, 1), (2, 1) and (2, 2), (2, 2) and (3, 2), and (3, 2) and (3, 3).
Screenshot:

CSV (with row numbers and column letters as one might expect in Excel or Google Docs):
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | o (1,3) | o (2,3) | b (3,3) | ||||||
| 2 | w | ||||||||
| 3 | o (1,2) | o (2,2) | w | o (3,2) | |||||
| 4 | w | ||||||||
| 5 | ke o (1,1) | w | o (2,1) | o (3,1) | |||||
| 6 | |||||||||
| 7 | |||||||||
| 8 | symbol | kn | ke | ks | kw | o | b | w | (x,y) |
| 9 | meaning | Karel facing north | Karel facing east | Karel facing south | Karel facing west | empty cell | cell with at least one beeper | wall between cells | cell coordinates |
If you would like control over the rate at which Karel executes you can add the following line to main.cc between LoadWorld and KarelProgram:
EnablePromptBeforeAction();This will cause Karel to wait for you to enter any character in the command line before taking the next action.