Rice Collection Ledger — Pseudocode

Write the steps for the rice collection ledger: AND and OR, nested loops, searching and sorting. 15 levels, played right in the browser with nothing to install.

What the levels ask

  1. At the end of the month the collected rice is shared out. The neighbourhood head says the rice goes to neighbours who are 60 or older and live alone. There is only enough for three bags. Mr. Rizal will knock on six doors carrying Ms. Yuyun’s steps. Fill in the word that joins the two conditions.
  2. Every night each house fills the bamboo tube by its door: a pinch of rice or one coin. Some tubes were empty last night. Ms. Yuyun wants to remind their owners politely. Complete the condition so only the tubes that hold neither rice nor a coin get a reminder note.
  3. This month the neighbourhood head adds to the rule: rice goes to neighbours who live alone, and are also old or ill. Ms. Yuyun’s steps already work out elderly. Pick the condition that reads that rule correctly.
  4. The neighbourhood has three lanes with four houses each. Tonight Mr. Rizal collects the rice collection tubes. So he does not walk back and forth, he has to finish one lane first, then move to the next. Pick the outer loop and the inner loop.
  5. The neighbourhood head asks: in a week, how many pinches come in from twelve houses? Every night every house gives one pinch. Pick where the line pinches ← pinches + 1 goes so the count is right.
  6. Ms. Yuyun writes a tally in the book’s margin: for each night, how many tubes held rice. Her steps read six tubes a night with READ tube. Pick where the line rice ← 0 goes so each night’s number does not carry over from the night before.
  7. Grandma Marni asks: is my house in the book, and on which page? Mr. Darmo, whose house is at the very front, asks the same. This year’s book holds 24 houses, six rows to a page. Pick the loop’s start and end so Mr. Rizal’s finger checks every row, from the first to the last.
  8. The book holds 60 houses now. On the neighbourhood’s WhatsApp group, Mr. Paijo and Mrs. Juwariyah ask for their page. Mr. Rizal searches by torchlight, and every row checked takes time. Complete the WHILE condition so his finger stops as soon as the name is found, instead of going on to the last row.
  9. Mr. Gimin has just moved into the neighbourhood and asks whether his house is in the book. It is not yet. Mrs. Sukini, whose row is the very last, and Ms. Rini ask too. Pick where the answer goes and the condition that decides not in the book, so each person gets one right answer.
  10. The neighbourhood head brings two books sorted by house number: the neighbourhood’s (100 houses) and the ward’s (1,000 houses). Searching one row at a time can take hundreds of rows. Ms. Yuyun has another way: open it in the middle, read the number, then throw away the half that cannot hold the house. Complete the two steps after a guess that misses.
  11. For tomorrow’s round, the house cards on the mat must be in number order. Card 11 and card 5 have swapped places. Mr. Rizal can only hold one card while he arranges the other, so there is a small tray to hold one card. Put the three steps in order so the two cards trade places and no card is lost.
  12. Ms. Yuyun works out a way to sort the cards: compare two neighbouring cards from left to right, and swap them when they are the wrong way round. One pass first. Complete the loop’s end and the sign so that after one pass the card with the biggest number is on the far right.

And more, 15 levels in all.