Recent

Author Topic: Rubik's cube F2L solver  (Read 19391 times)

CM630

  • Hero Member
  • *****
  • Posts: 1191
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Rubik's cube F2L solver
« Reply #15 on: August 02, 2021, 04:52:13 pm »
IMHO it would be nicer if there was some sound. I have an original Rubiks cube from the old times - it is noisy indeed and it's a part of the whole thing.
Лазар 4,0RC1 32 bit (sometimes 64 bit); FPC3,2,2

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1251
Re: Rubik's cube F2L solver
« Reply #16 on: August 03, 2021, 08:01:26 am »
hello,
So it is MANY years later.  Are you still unsure about releasing the source?  I just asked my 5 year old daughter to come up with a problem that we can solve by writing a computer program.  She brought me a Rubicks cube and said "this!! lets write a program that puts this back!"  :)

So my skills aren't nearly good enough to solve that with Lazarus at this point!  Some day I hope... either way I would like to see if I can get her interested by using the source of a Rubicks Cube Solver.  lol... she can't really even read much yet so this may be a challenge but my older daughter who can read is very creative and smart.  So this may be the beginning of 2 genius programmers...
As a starting point you can try this french delphi project   rubik's cube  Creative Commons Licence
To Do :
1 - Convert to Lazarus --> seems to be OK no error , can be execute
2 - Translate to your language
3 - Correct the solver -> Solver OK in Delphi 7 not OK in Lazarus ( Error )
4 - Optimize the Solver
5 - Optimize the 3D renderer

have fun

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Tony Stone

  • Full Member
  • ***
  • Posts: 234
Re: Rubik's cube F2L solver
« Reply #17 on: February 20, 2024, 04:26:16 am »

Well here it is converted to a Lazarus project, I translated much of the language to English and I fixed the issue where it was not solving the Rubiks Cube.  I just want to put this here so if anyone in the future wants to improve it we now have a working version with English.

As a starting point you can try this french delphi project   rubik's cube  Creative Commons Licence
To Do :
1 - Convert to Lazarus --> seems to be OK no error , can be execute
2 - Translate to your language
3 - Correct the solver -> Solver OK in Delphi 7 not OK in Lazarus ( Error )
4 - Optimize the Solver
5 - Optimize the 3D renderer

have fun

Friendly, J.P


Tony Stone

  • Full Member
  • ***
  • Posts: 234
Re: Rubik's cube F2L solver
« Reply #18 on: February 28, 2024, 11:04:19 pm »
In case anyone is interested in this post I put the program on github.  I renamed many things to english so it makes sense and I am starting to make sense of the code.  Except the 3D rendering is still hurting my brain.  I mad the GUI way more functional and easier to use.  I set an initial 3d view of the cube angled at 45 degrees down and left to see the faces.  If any of you are really Rubiks cube experts I would like to know if you think the Cube notation is incorrect for the left and right side of the cube I think the original author of this code has those backwards but it still solves.   Anyway for anyone interested: https://github.com/TonyStone31/softcube

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Rubik's cube F2L solver
« Reply #19 on: February 29, 2024, 09:45:43 am »
I tried the version in Github.
With LCL-GTK2 I get a nice animated cube when it is solved.
With LCL-QT5 the graph is not updated. Only when I wave my mouse cursor over the "Set State" and "Target State" tabs, it sometimes updates.
Maybe it needs "Invalidate" calls somewhere.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Dzandaa

  • Sr. Member
  • ****
  • Posts: 388
  • From C# to Lazarus
Re: Rubik's cube F2L solver
« Reply #20 on: February 29, 2024, 10:37:09 am »
Hi

I think there is an error in line 708 of URubik:

as:
Code: Pascal  [Select][+][-]
  1. const
  2.   QuoiFaire2: array[1..12, 1..4] of integer =
  3.     ((1234, 0, 0, 0), (1342, 2, 2, 2), (1423, 1, 2, 0), (2143, 2, 4, 1), (2314, 2, 3, 3), (2431, 2, 4, 4), (3124, 1, 3, 0), (3241, 2, 1, 1), (3412, 2, 4, 3), (4132, 1, 4, 0), (4213, 1, 1, 0), (4321, 2, 3, 4));
  4.  

Code: Pascal  [Select][+][-]
  1.   for i := 1 to 24 do if QuoiFaire2[i, 1] = c1 * 1000 + c2 * 100 + c3 * 10 + c4 then n := i;

Shoud be:

Code: Pascal  [Select][+][-]
  1.   for i := 1 to 12 do if QuoiFaire2[i, 1] = c1 * 1000 + c2 * 100 + c3 * 10 + c4 then n := i;

or am I wrong?

B->
Regards,
Dzandaa

Tony Stone

  • Full Member
  • ***
  • Posts: 234
Re: Rubik's cube F2L solver
« Reply #21 on: February 29, 2024, 04:29:54 pm »
Yes it should be 12!  I have left the range checks off because it crashed and that is how the original source was.  I wish I read your entire post because I just wasted 20 minutes trying to solve that issue myself because you brought it up.  But yes In my mind I came up with 12 as well so I think we are probably correct.  Because it is 4 corners with 3 faces... As far as not rendering properly with QT5 I have not tested myself but some day I will.  :) 

As I am starting to understand it more I have begun studying some other programs that do "advanced solves" where they are able to solve it in under 20 moves no matter the state of the cube.  I can't believe I am becoming so obsessed with such a stupid little toy like a Rubiks cube!  But it has so many interesting aspects to it lol!

Hi

I think there is an error in line 708 of URubik:

as:
Code: Pascal  [Select][+][-]
  1. const
  2.   QuoiFaire2: array[1..12, 1..4] of integer =
  3.     ((1234, 0, 0, 0), (1342, 2, 2, 2), (1423, 1, 2, 0), (2143, 2, 4, 1), (2314, 2, 3, 3), (2431, 2, 4, 4), (3124, 1, 3, 0), (3241, 2, 1, 1), (3412, 2, 4, 3), (4132, 1, 4, 0), (4213, 1, 1, 0), (4321, 2, 3, 4));
  4.  

Code: Pascal  [Select][+][-]
  1.   for i := 1 to 24 do if QuoiFaire2[i, 1] = c1 * 1000 + c2 * 100 + c3 * 10 + c4 then n := i;

Shoud be:

Code: Pascal  [Select][+][-]
  1.   for i := 1 to 12 do if QuoiFaire2[i, 1] = c1 * 1000 + c2 * 100 + c3 * 10 + c4 then n := i;

or am I wrong?

B->


 

TinyPortal © 2005-2018