traffic: having the solutions displayed as an hint
Open, Needs TriagePublic

Description

Last levels are really difficult.

We should have the possibility to help the children find the next moves to help them progress.

Format of the solution needs to be discussed and where we implement it

jjazeix created this task.Aug 30 2020, 9:09 AM
jjazeix updated the task description. (Show Details)

Can I work on this?

aasthachauhan added a comment.EditedMar 1 2022, 7:42 AM

@jjazeix Hi, I wanted to know that the positions for cars and trucks are fixed for all 65 levels(13 levels with 5 sublevels in each), and currently, I can think of a brute force approach for the hints, that would be level specific, what do you suggest here?

The initial positions are hardcoded in https://invent.kde.org/education/gcompris/-/blob/master/src/activities/traffic/traffic.js

There are no unique answers, so we need to make sure we don't do unnecessary moves and find the easiest combination for each possible combination.

Also, we need to be careful that the computing do not take too much time and lag the application (so it should be only done when the child is in hint mode).

Best would be to find an algorithm that, at a given state, gives the stack of the next moves to do. If the child follows the moves, we just have to pop the stack. If not we need to compute it again.

aasthachauhan removed aasthachauhan as the assignee of this task.Mar 6 2022, 2:23 PM

I've found a good command-line software that is able to find solutions for this type of game. We can probably use it as reference or reuse some of its code for this hint feature.

https://github.com/gateship1/rushhour

(it's in C++ without apparent dependencies, Apache 2.0 license)

In js, there is also https://github.com/its-your-favorite/RushHourSolver/ (algorithm explained in https://blog.alexrohde.com/archives/408 but no licence) or https://github.com/VolticFroogo/rush-hour-web (AGPLv3). First code must not be used.

hadron added a subscriber: hadron.Dec 29 2023, 4:11 PM