I want to solve a riddle. But I just don’t know what code is needed for this. The task is exponential.
Description:
The player walks / works one step at a time. Sometimes a decision will be made; this is a yes / no question. After answering the question, the player continues to go until the next decision / question. Continue this until the general cover is closed.

The problem is, I want to see every possible route through this (many python lists, such as ["y", "y", "n", "y", "n"]). Here is the code that I have written so far: (Player is in the Player() class, I deleted it because it doesn’t matter here).
class Solver(object): """ Solver object. """ def __init__(self, field): self.field = field self.dinc = 113 self.distance = 128 def take_step(self, player): """ Takes a step and records players route. """
The solution of what I'm looking for is as follows:
- Go through until the question is reached.
- Make a copy of the route
- On route A say yes
- On Route B (copy), indicate No
Route A:
repeat the one above (this unfolds two more routes)
Route B:
repeat the one above (this unfolds two more routes)
Using the code that I have is something like:
route_a = Player() solver = Solver()
This problem is exponential because with each solution, the route develops two more routes. I need all the features; I know that there are less than 512 possibilities, so a computer can solve this in an instant.
Each route will be stored in the Player.route instance (as a list, for example: ['y', 'y', 'n', 'y'])
I just have no idea how to solve a problem like this programmatically. I would appreciate some ideas on how to structure the code to solve such a problem.