smack42 / DriftingDroids

DriftingDroids - yet another Ricochet Robots solver program
https://github.com/smack42/DriftingDroids/wiki
GNU General Public License v3.0
41 stars 12 forks source link

Use finnish position as start for next game #2

Closed rubo77 closed 10 years ago

rubo77 commented 10 years ago

Please add an option to start a new game with the robots at startpositions, that were the end position of the last game

smack42 commented 10 years ago

Please explain in detail what you mean with this request.

rubo77 commented 10 years ago

This is How we play Ricochet Robots: 1.We throw a random color on a random field and then that robot has to go there. 2.At the end, we move the needed robots with the minimum moves to their end position in that puzzle.

  1. we throw a new color to a new field, all robots are positioned at the position they ended in the last puzzle.

Right now it also kinda works for us, but we have to click for all single robots by hand to move them into positions for the new game.

So if that would be easy, it would be cool to have a button at the end "start new game with the actua positions" without moving the robots to new random positions.

smack42 commented 10 years ago

Aha, you're playing the game by your own custom rules! After each round you need to switch to the DriftingDroids custom board editor and there remove the current goal and set the new goal, right?

I think I know now what you requested: when you return from the board editor to the solution screen then the robot positions are reset to the previous starting position. You want them to stay on the final positions after the last move of the previous round.

Is that correct? If so then the fix should be simple, I think.

rubo77 commented 10 years ago

Yes cool

smack42 commented 10 years ago

Program now remembers the current robot positions when you switch to the custom board editor and later switch back to solution screen. b4ffceed5dd142c6e5da03799571d5cff7e1d6c9

rubo77 commented 10 years ago

Is this testable in a release already? Or do I have to install eclipse and start it in the developer UI?

smack42 commented 10 years ago

No release yet, but I can build 1.3.3 soon if no big problems arise.

You don't need to install Eclipse if you only want to compile the program - you can do it like this:

compile

cd src/
javac -cp ../designgridlayout-1.11.jar driftingdroids/ui/*.java driftingdroids/model/*.java

run (still in src/ directory)

java -Xmx800M -cp .:../designgridlayout-1.11.jar driftingdroids.ui.Starter
rubo77 commented 10 years ago

And on Windows? How do I compile and run it in the Powershell? Its not the same command there, "javac is not recognized"

But I will restart my computer into ubuntu now, feels safer anyway ;)

smack42 commented 10 years ago

I don't have a Windows here now but I think it must be very similar. Perhaps you need to use \ instead of / and you may need to write the full path to "javac.exe" in the command line.

rubo77 commented 10 years ago

I tried in ubuntu now:

/src$ javac -cp ../designgridlayout-1.11.jar driftingdroids/ui/*.java driftingdroids/model/*.java
Note: driftingdroids/ui/SwingGUI.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

But it worked anyway...

Now I can produce an error:

In a custom game, I deleted all goals and set one new goal for the red robot. Then I clicked on all hints, until the last move was shown.

Then I clicked on "Spiel vorbereiten" and back to "Spielen" then like desired, all robots were still at the same position, but the goal too, meaning, the red robot was sitting already on top of his goal.

I think that is why the game hangs now, cause it tries to calculate the impossible, ... it would be "0 Moves" ;)

smack42 commented 10 years ago

The compiler warning is no problem at all.

This game situation when the active robot starts on the goal position (zero moves required) is recognized and handled by the solver algorithm (take a longer route to the goal) - it shouldn't crash or hang the program. Probably there is a bug, will check this.

smack42 commented 10 years ago

I've just fixed a bug and another potential problem. 10ca3e43d273d3634ceef42e28b2295d3635f4e3 Now the program doesn't hang or crash anymore in my tests.

Please test and let me know when you find any problems. Thanks!