From charlesreid1

Revision as of 20:01, 21 April 2025 by Unknown user (talk) (Created page with "Link: https://projecteuler.net/problem=334 ==Beans Game== In Plato's heaven, there exist an infinite number of bowls in a straight line. Each bowl either contains some or n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Link: https://projecteuler.net/problem=334

Beans Game

In Plato's heaven, there exist an infinite number of bowls in a straight line.

Each bowl either contains some or none of a finite number of beans.

A child plays a game, which allows only one kind of move: removing two

beans from any bowl, and putting one in each of the two adjacent bowls.

The game ends when each bowl contains either one or no beans.

For example, consider two adjacent bowls containing

and beans respectively, all other bowls being empty. The following eight moves will finish the game:

0 0 2 3 0 0

0 1 0 4 0 0

0 1 1 2 1 0

0 1 2 0 2 0

0 2 0 1 2 0

0 2 0 2 0 1

0 2 1 0 1 1

1 0 2 0 1 1

1 1 0 1 1 1

Approach

Before trying to tackle the full problem, I started by thinking about the game, and how it could be efficiently represented


Flags