Clear Filters
Clear Filters

Connect the dots game solver

49 views (last 30 days)
Ahmed
Ahmed on 8 Aug 2023
Answered: Kenna on 19 Feb 2024
I currently have a cell array of size Nx2, where in the first column of the cell array I have an array of size Mx2. in this array I have M points for the connect the dots game and the 2 signals the x and y coordinates of each point, this array has the points randomized (so connecting them in the given order doesn’t solve the game), in the corresponding cell I have the solution to this connect the dots problem where the rows are ordered to complete the connect the dots game (as you can see In the attached image, the shape doesn’t intersect itself and the final point is the starting point)
I would like to train a model using my N samples of solutions to be able to take any future connect the dots arrays (no matter the shape) and be able to order the points to solve the game. Any suggestions of recommendations is appreciated.

Answers (2)

Anurag
Anurag on 24 Aug 2023
As per my understanding of your problem, I see that given a column of points (x,y coordinates) in a randomised order corresponding to the order in which they are to be connected, you wish to develop a ML model to predict the correct ordering of the coordinates when fed with new points.
This problem deals with the sequence ordering problem where we want to predict the correct order of points to solve the game.
Due to it being a sequence prediction problem, you need to use a Recurrent Neural Network (RNN) or Long Short-Term Memory (LSTM) networks since these models are designed to work with sequential data.
  • Flatten the M x 2 array of points into a 1D array for each sample.
  • This transformation would result in N sequences of points.
  • These sequences of points can be utilized to train an RNN/LSTM model.
  • The RNN/LSTM model takes sequences of point coordinates as input.
  • The model's goal is to predict the correct order of indices as output.
  • The model architecture could include:
An embedding layer for the input points.
One or more LSTM layers after the embedding.
An output layer that predicts the indices of the point order.
Hope this helps!

Kenna
Kenna on 19 Feb 2024
You could consider training a model using your N samples of solutions to predict the correct order of points in future connect-the-dots arrays. This task is akin to solving a complex puzzle, similar to the challenge presented by the rice purity test where one must carefully navigate through various scenarios to achieve the desired outcome.

Categories

Find more on Number games in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!