Beginner 4
Hello! This is page 6 of the course called “Y Combinator for Non-programmers”. If you just got here, click here to read from the beginning.

Y Combinator for
Non-programmers

Beginner 5: Lunchboxes with 3 Rows

Slide 1 / 21

This is the final beginner level

This is the final page of the beginner levels. Thank you for following along so far.

Warning: The “Lunchbox” puzzles on this page are much harder than before. But I think you’ll still be able to solve them. Good luck!

The puzzles are hard, but you can do it!

Looking for some other page?

Beginner 4·
·Intermediate 1
Slide 2 / 21

Lunchboxes with 3 Rows

From now on, you’ll be solving much harder puzzles like this one:

The “Lunchbox” puzzle with 3 rows
2
1
12

Hmm… previously, we’ve only dealt with lunchboxes with 2 rows.

But this one has 3 rows vertically.

Also, there are 3 items on the bottom row: sushi , a sandwich , and another sushi .

None of the lunchboxes we saw on the last page had 3 items in one row.

Right. Also, did you realize that there are numbers like 1 and 2 on the left edge?

There are numbers like 1 and 2
on the left edge
2
1
12

That’s true…

How should we solve puzzles like this?

I’ll show you.

  1. First: I’ll explain how to solve lunchbox puzzles with 3 rows.
  2. Then: I will give you Yes / No quizzes to solve.

Ok, sounds good.

Slide 3 / 21

First, focus on the pair of 1’s

The first step in solving a “Lunchbox” puzzle with 3 rows is to focus on the pair of 1’s.

11
Focus on the pair of 1’s

More specifically: You need to take a look at the sections that have a 1 on their top-left corner or bottom-left corner.

Let’s see what that means. Press Next :

2
1
12

The pair of 1’s became pink 1’s.

Also, the top row now has a darker color .

Right. This means:

  • Focus on the bottom two rows, which correspond to the pair of 1’s, and
  • Ignore the top row for now.
Focus on the bottom two rows, and
Ignore the top row for now
2
1
12
Slide 4 / 21

t l r and m

Next: we add the labels. Press Next :

2
1
12

In addition to t l, and r

There’s a new label m for the sandwich .

There’s a new label m
for the sandwich
2
1
t
l
12
m
r

Yes, this is new: None of t, l, or r apply to the middle item on the bottom row.

In that case, we add the label m (for “Middle”) to it.

m
Add m to the middle item
on the bottom row

I see. Then what do we do with the m’s?

Slide 5 / 21

Ignore m’s

Answer: You can ignore m’s for now.

mm
Ignore m’s for now

Why? Take a look at the next steps:

  • Match: l r
  • Copy: t r
  • Remove: t l

None of them involves m. So, while we do these next steps, you can ignore m’s.

Ignore the sandwich labeled as m
for the next several steps
2
1
t
l
12
m
r

Got it. Let’s continue then.

Slide 6 / 21

Finish the pair of 1’s

Next: We’ll finish the section that belongs to the pair of 1’s.

11
Finish the pair of 1’s

This will be a review of the last page.

First: We check to see if some of l’s and r’s match. If they match, add the sign. Press Next :

2
1
t
l
12
m
r

Next: We copy t’s to where the matched r’s are.

2
1
t
l
12
m
r

Finally: We remove t’s and l’s.

2
1
t
l
12
m
r

See, none of the above steps involved m, right?

I see—that’s why we can ignore m for now.

Slide 7 / 21

1’s disappear, and 2’s become 1’s

Let’s keep going! Press Next :

2
1
t
l
12
  • t and l are removed,
  • The pair of 1’s are also removed, and…
  • The pair of 2’s became the new pair of 1’s.
21
Slide 8 / 21

Finish the remaining part

We now have a simpler lunchbox.

We now have a simpler lunchbox
1
1

Yes. Also, notice that:

  • The sandwich was labeled as m earlier…
  • But it is now labeled as l because it’s on the “Left” now.
The sandwich is now labeled as l
1
t
l
1
r

Let’s keep going to the end. Press Run :

Press Run . (Or press to step through manually.)

1
t
l
1
r

We’re left with a hamburger .

That’s it! Were you able to follow?

Hmm… I might need to look at it one more time.

Ok, let’s do a review just in case.

We’ll run it from the beginning to the end using the Run button.

Press Run . (Or press to step through manually.)

2
1
12

To summarize:

  1. Start with the pair of 1’s.
  2. Label the middle item on the bottom row as m, and ignore it.
  3. After finishing the pair of 1’s, the pair of 2’s becomes 1’s. Then, repeat.

Is this right?

Perfect. Let’s do a Yes / No quiz to check your understanding.

Alright, bring it on!

Slide 9 / 21

Yes / No Quiz

Take a look at this lunchbox:

2
1
12

Question: If we run the above lunchbox, will it eventually become the following?

It’s okay if you have no idea.
Just guess!

Beginner 4
Japanese Site (日本語版) · About this Site · Twemoji