Let me first say that I do NOT want code or any existing solvers.
For a project in my intro to computer science class, I decided to write a solver for the floppy cube in Python. It's simple, as expected, but I don't feel like it's very elegant. I'm not sure how to go about actually searching for puzzles that need a deeper depth.
In my program there is a function called 'move' that takes in a list describing the state of the puzzle and a string containing the move and changes the list based on what the move would do on the physical puzzle. I'm looping through the possible moves for each element in a given depth solution algorithm. Example-
stateToCheck = move(move(move(initialState),move1),move2),move3)
where move1, move2, and move3 take on U, R, L, D.
Of course, my loop and particularly the code for checking for redundant moves (U U) has to be copied and pasted and edited for EACH depth that I want to search for. For something as simple as a floppy cube, that's still 8 times.
Does anyone have any hints as to how I might make a better approach at this? I'm going to start working on a solver for the 2x2x3 for my own learning and enjoyment.
For a project in my intro to computer science class, I decided to write a solver for the floppy cube in Python. It's simple, as expected, but I don't feel like it's very elegant. I'm not sure how to go about actually searching for puzzles that need a deeper depth.
In my program there is a function called 'move' that takes in a list describing the state of the puzzle and a string containing the move and changes the list based on what the move would do on the physical puzzle. I'm looping through the possible moves for each element in a given depth solution algorithm. Example-
stateToCheck = move(move(move(initialState),move1),move2),move3)
where move1, move2, and move3 take on U, R, L, D.
Of course, my loop and particularly the code for checking for redundant moves (U U) has to be copied and pasted and edited for EACH depth that I want to search for. For something as simple as a floppy cube, that's still 8 times.
Does anyone have any hints as to how I might make a better approach at this? I'm going to start working on a solver for the 2x2x3 for my own learning and enjoyment.