I am making a basic program using xLibC that tells how to solve 6 different types of rubik's cubes.
Who wants to help w/ the code?
well, I am not familiar with xLib, but can help out with the generic BASIC code (menus, flow, formatting, all of the non-graphic stuff)
I want to help you too, but can you give us some more information? What will it exactly do, what do you have already so far, what are you going to add etc.? Do you need help with xLIBC or the program structure? What do you expect of us?
The program starts by displaying the six types of cubes that i am including in it, and you highlight the one that you want and select with 2nd of enter, and it goes to a screen that displays the cube situation that you want to fix, and then it tells you how to fix it. I want it to be able to scroll between the different teps for each cube by pressing left and right. You can go back to the menu with clear or delete, and you can quit with the same two keys. Do you want me to send you what i have done so far? ( I started it last night)
Pieman7373 wrote:
The program starts by displaying the six types of cubes that i am including in it, and you highlight the one that you want and select with 2nd of enter, and it goes to a screen that displays the cube situation that you want to fix, and then it tells you how to fix it. I want it to be able to scroll between the different teps for each cube by pressing left and right. You can go back to the menu with clear or delete, and you can quit with the same two keys. Do you want me to send you what i have done so far? ( I started it last night)

If you already have the solving code, I think displaying the correct Rubik's cube arrangement and being able to scroll through the steps should be quite trivial. Your code probably goes through a series of loops, therefore, every time it comes up with a new step, add in a getkey loop (or real(2.0.0 if you want to maximize your use of xlibc) where the user can input the arrow keys. If you've coded it using matrices or lists (hopefully with numbers 1 through 9), simply refreshing the screen grabbing the new modified values in the the list/matrix, linking each value to an actual color code from the palette, and finally, displaying the 9 squares with the new color codes seems like a fairly reasonable solution. If you've done it using only variables, the process would be similar, but probably a little slower and larger in terms of bytes since you would have to update each variable in different snippets or code.
mr womp womp wrote:
Pieman7373 wrote:
The program starts by displaying the six types of cubes that i am including in it, and you highlight the one that you want and select with 2nd of enter, and it goes to a screen that displays the cube situation that you want to fix, and then it tells you how to fix it. I want it to be able to scroll between the different teps for each cube by pressing left and right. You can go back to the menu with clear or delete, and you can quit with the same two keys. Do you want me to send you what i have done so far? ( I started it last night)

If you already have the solving code, I think displaying the correct Rubik's cube arrangement and being able to scroll through the steps should be quite trivial. Your code probably goes through a series of loops, therefore, every time it comes up with a new step, add in a getkey loop (or real(2.0.0 if you want to maximize your use of xlibc) where the user can input the arrow keys. If you've coded it using matrices or lists (hopefully with numbers 1 through 9), simply refreshing the screen grabbing the new modified values in the the list/matrix, linking each value to an actual color code from the palette, and finally, displaying the 9 squares with the new color codes seems like a fairly reasonable solution. If you've done it using only variables, the process would be similar, but probably a little slower and larger in terms of bytes since you would have to update each variable in different snippets or code.

I know how to solve all sizes of rubik's cube and several other types, so the solving shouldn't be a problem. I am pretty much doing what you said otherwise. Do you want to see the code?
Pieman7373 wrote:
(...)
I know how to solve all sizes of rubik's cube and several other types, so the solving shouldn't be a problem. I am pretty much doing what you said otherwise. Do you want to see the code?
That sounds like a good idea, so we can probably help you.
I mostly have the shell of the program finished (w/o any information in it) so i can put the code in the thread, so you can see/ critique it.

Code:

DCS
"DDDD3AA366333113DDD3AAAA33111130DD33333333333300DD35555336666303DD35553223666303DD3553222236633ADD3532222223633ADD3322222222333ADD332222222233A3DD313222222323AADD311322223223AADD311132232223A3DD3111133222233DDD333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
If 80>det([[20:Then:Disp "Get Doors CSE to run this:","http://dcs.cemetech.net":Return:End
Lbl A
24->X:5->Y:1->A
real(0,1,1
real(8,1,0
real(0,3,4,149,0
real(7,7,25,6,34,34,0,0
real(7,7,25,43,34,34,0,0
real(7,7,26,81,33,33,0,0
real(7,7,97,8,31,31,0,0
real(7,7,97,45,31,31,0,0
real(7,7,95,80,34,34,0,0
real(7,5,42,6,42,39,0,0
real(7,5,25,23,58,23,0,0
real(7,5,36,43,36,76,0,0
real(7,5,47,43,47,76,0,0
real(7,5,25,54,58,54,0,0
real(7,5,25,65,58,65,0,0
real(7,5,34,81,34,113,0,0
real(7,5,42,81,42,113,0,0
real(7,5,50,81,50,113,0,0
real(7,5,26,89,58,89,0,0
real(7,5,26,97,58,97,0,0
real(7,5,26,105,58,105,0,0

real(7,5,111,81,96,96,0,0
real(7,5,111,113,96,97,0,0
real(7,5,110,113,128,96,0,0
real(7,5,128,97,112,81,0,0
"2,x,2"->Str1
Ans:Str1
real(6,0,16,10,24,44,0
"3,x,3"->Str1
real(6,0,16,48,24,44,0
"4,x,4"->Str1
real(6,0,16,85,24,44,0
"5,x,5"->Str1
real(6,0,85,10,24,44,0
"6,x,6"->Str1
real(6,0,85,48,24,44,0
"S,k,e,w,b"->Str1
real(6,0,85,78,24,44,0
real(7,9,26,44,10,10,224,0
real(7,9,26,55,10,10,231,0
real(7,9,26,66,10,10,24,0
real(7,9,37,44,10,10,68,0
real(7,9,37,55,10,10,255,0
real(7,9,37,66,10,10,227,0
real(7,9,48,44,10,10,227,0
real(7,9,48,55,10,10,24,0
real(7,9,48,66,10,10,255,0
real(7,9,26,7,16,16,227,0
real(7,9,43,7,15,16,224,0
real(7,9,26,24,16,15,255,0
real(7,9,43,24,15,15,24,0
real(7,9,96,81,8,8,68,0
real(7,9,104,81,4,4,68,0
real(7,9,108,81,2,2,68,0
real(7,9,110,81,1,1,68,0
real(7,9,108,83,1,1,68,0
real(7,9,104,85,2,2,68,0
real(7,9,106,85,1,1,68,0
real(7,9,104,87,1,1,68,0
real(7,5,97,50,127,50,0,0
real(7,5,97,55,127,55,0,0
real(7,5,97,60,127,60,0,0
real(7,5,97,65,127,65,0,0
real(7,5,97,70,127,70,0,0
real(7,5,102,45,102,75,0,0
real(7,5,107,45,107,75,0,0
real(7,5,112,45,112,75,0,0
real(7,5,117,45,117,75,0,0
real(7,5,122,45,122,75,0,0
real(7,5,97,14,127,14,0,0
real(7,5,97,20,127,20,0,0
real(7,5,97,26,127,26,0,0
real(7,5,97,32,127,32,0,0
real(7,5,103,8,103,38,0,0
real(7,5,109,8,109,38,0,0
real(7,5,115,8,115,38,0,0
real(7,5,121,8,121,38,0,0

Lbl B
real(7,7,X,Y,36,36,135,0
getKey->K
X+70(K=26)-70(K=24)->X
Y+37(K=34)-37(K=25)->Y
If K=26:real(7,7,24,Y,36,36,149,0
If K=24:real(7,7,94,Y,36,36,149,0
If K=23 or K=45:Stop
If K=25:real(7,7,X,Y+37,36,36,149,0
If K=34:real(7,7,X,Y-37,36,36,149,0
If K=26 and X-70=94
Then
   24->X
   real(7,7,94,Y,36,36,149,0
End
If K=24 and X+70=24
Then
   94->X
   real(7,7,24,Y,36,36,149,0
End
If K=25 and Y+37=5:79->Y
If K=34 and Y-37=79:5->Y
If K=21 or K=105:Goto C
If K=93:Goto 2
If K=94:Goto 3
If K=82:Goto 4
If K=83:Goto 5
If K=84:Goto 6
If K=81:Goto SK
Goto B
Return
Lbl C
If X=24 and Y=5:Goto 2
If X=24 and Y=42:Goto 3
If X=24 and Y=79:Goto 4
If X=94 and Y=5:Goto 5
If X=94 and Y=42:Goto 6
If X=94 and Y=79:Goto SK
Return

Lbl 2
real(0,3,4,149,0
If A=0:3->A
If A=4:1->A
If A=2 or A=3
Then
   real(7,7,10,40,25,25,0,0
   real(7,7,34,40,25,25,0,0
   real(7,7,10,64,25,25,0,0
   real(7,7,34,64,25,25,0,0
   real(7,5,40,15,90,15,0,0
   real(7,5,90,15,90,64,0,0
   real(7,5,10,40,40,15,0,0
   real(7,5,58,40,90,15,0,0
   real(7,5,58,88,90,64,0,0
End
If A=1
Then
   "page.1,2x2"->Str3
   Ans:Str3
   real(6,0,0,0,135,44,0
   "Solving,first,intuitiv,didn't i,any inst"->Str1
   "the,layer is,e so I,nclude,ructions"->Str2
   Ans:Str1
   real(6,0,16,40,24,44,0
   Ans:Str2
   real(6,0,80,40,24,44,0
End
If A=2
Then
   "page.2,2x2"->Str3
   Ans:Str3
   real(6,0,0,0,135,44,0
End
If A=3
Then
   "page.3,2x2"->Str3
   Ans:Str3
   real(6,0,0,0,135,44,0
End
Lbl 2A
getKey->K
If K=23 or K=45:Goto A
If K=26
Then
   A+1->A
   Goto 2
End
If K=24
Then
   A-1->A
   Goto 2
End
Goto 2A
Return

Lbl 3
real(0,3,4,149,0)
If A=0:7->A
If A=8:1->A
If A=1
Then
   "page.1,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=2
Then
   "page.2,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=3
Then
   "page.3,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=4
Then
   "page.4,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=5
Then
   "page.5,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=6
Then
   "page.6,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=7
Then
   "page.7,3x3"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
Lbl 3A
getKey->K
If K=23 or K=45:Goto A
If K=24:Then:A-1->A:Goto 3:End
If K=26:Then:A+1->A:Goto 3:End
Goto 3A
Return

Lbl 4
real(0,3,4,149,0
If A=0:5->A
If A=6:1->A
If A=1
Then
   "page.1,4x4"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=2
Then
   "page.2,4x4"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=3
Then
   "page.3,4x4"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=4
Then
   "page.4,4x4"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=5
Then
   "page.5,4x4"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
Lbl 4A
getKey->K
If K=23 or K=45:Goto A
If K=26:Then:A+1->A:Goto 4:End
If K=24:Then:A-1->A:Goto 4:End
Goto 4A
Return

Lbl 5
real(0,3,4,149,0
If A=0:5->A
If A=6:1->A
If A=1
Then
   "page.1,5x5"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=2
Then
   "page.2,5x5"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=3
Then
   "page.3,5x5"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=4
Then
   "page.4,5x5"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=5
Then
   "page.5,5x5"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
Lbl 5A
getKey->K
If K=23 or K=45:Goto A
If K=24:Then:A-1->A:Goto 5:End
If K=26:Then:A+1->A:Goto 5:End
Goto 5A
Return

Lbl 6
real(0,3,4,149
If A=0:10->A
If A=11:1->A
If A=1
Then
   "page.1,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=2
Then
   "page.2,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=3
Then
   "page.3,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=4
Then
   "page.4,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=5
Then
   "page.5,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=6
Then
   "page.6,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=7
Then
   "page.7,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=8
Then
   "page.8,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=9
Then
   "page.9,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=10
Then
   "page.10,6x6"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
Lbl 6A
getKey->K
If K=23 or K=45:Goto A
If K=24:Then:A-1->A:Goto 6:End
If K=26:Then:A+1->A:Goto 6:End
Goto 6A
Return

Lbl SK
real(0,3,4,149,0
If A=0:2->A
If A=3:1->A
If A=1
Then
   "page.1,Skewb"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
If A=2
Then
   "page.2,Skewb"->Str1
   Ans:Str1
   real(6,0,0,0,135,44,0
End
Lbl SA
getKey->K
If K=23 or K=45:Goto A
If K=24:Then:A-1->A:Goto SK:End
If K=26:Then:A+1->A:Goto SK:End
Goto SA
Return
Now that you seem to have the basic structure of the program finished, how do you plan to give the information? I personally would explain the notation first off, then tell about the algorithms and basic steps and what they do (for example, explaining how to actually solve the white cross, and maybe some F2L algorithms could be included?) As for method, at least for the 3x3, I'd go with the total-beginner method that Rubik's teaches in their instruction booklets (or even F2L if you think they're gonna feel brave Razz ).
...Hold up, I'm confuzzled! Is this a program that teaches you the LBL algs or do you input certain scenarios and it generates a solving alg for you?

@JWinslow: Seconded, except for your last F2L statement. Leave that to the speedsolving wiki. Most people would need the LBL, not CFOP. Although a calc program with the CFOP algs would be nice...
GTemples27 wrote:
@JWinslow: Seconded, except for your last F2L statement. Leave that to the speedsolving wiki. Most people would need the LBL, not CFOP. Although a calc program with the CFOP algs would be nice...

'Twas a joke. However, a solver with the capability of doing this would be cool on a calc.

I'm actually interested in what direction this program will go...solver, or tutorial. Or BOTH.
Tutorial, I am not skilled enough at programming to do a solver, especially not one compatible with 6 different types of cube. Also, it would be confusing trying to input the scrambled cube, and tedious.
The program just tells you what steps to do for each movement you are trying to accomplish.
*BUMP*
Any progress of late, Pieman?
I am going to pick this up again, now that my hybrid basic skills have been sharpened by CC18 ;P
(thanks for that jonbush) ;P
Hey Pieman, do you have a GitHub? If not, you should make one; it makes everything a whole lot easier when sharing and editing code. If you have/get one, post the link in this topic, so I can possibly go and make some edits. If you don't want to make it, not a problem.
123outerme wrote:
Hey Pieman, do you have a GitHub? If not, you should make one; it makes everything a whole lot easier when sharing and editing code. If you have/get one, post the link in this topic, so I can possibly go and make some edits. If you don't want to make it, not a problem.


I have one... I dont have anything for this on it yet though Very Happy

https://github.com/Pieman7373/QBSOLVE/tree/master
Pieman7373 wrote:
123outerme wrote:
Hey Pieman, do you have a GitHub? If not, you should make one; it makes everything a whole lot easier when sharing and editing code. If you have/get one, post the link in this topic, so I can possibly go and make some edits. If you don't want to make it, not a problem.


I have one... I dont have anything for this on it yet though Very Happy

https://github.com/Pieman7373/QBSOLVE/tree/master

Okay, I've submitted a pull request that fixes a few things. You can see the full details in the pull request.

mr womp womp wrote:


Code:

"page."+eval(A)+",6x6->Str1


AFAIK, Pieman is using the CSE for this, which doesn't have the eval() function. You could have this instead:

Code:

"page."+sub("0123456789",A-1,1)+",6x6->Str1
123outerme wrote:
Pieman7373 wrote:
123outerme wrote:
Hey Pieman, do you have a GitHub? If not, you should make one; it makes everything a whole lot easier when sharing and editing code. If you have/get one, post the link in this topic, so I can possibly go and make some edits. If you don't want to make it, not a problem.


I have one... I dont have anything for this on it yet though Very Happy

https://github.com/Pieman7373/QBSOLVE/tree/master

Okay, I've submitted a pull request that fixes a few things. You can see the full details in the pull request.

mr womp womp wrote:


Code:

"page."+eval(A)+",6x6->Str1


AFAIK, Pieman is using the CSE for this, which doesn't have the eval() function. You could have this instead:

Code:

"page."+sub("0123456789",A-1,1)+",6x6->Str1

Haha, I realised this was in hybrid-basic and therefore not compatible with the CE yet, and therefore he must have been using the CSE, and thus, the eval() command was not available to him. This is why I promptly removed the post, but I guess you had time to quote me on that Razz
As for the code, you have to note that the page number sometimes goes up to double digits, and if we want to keep things in decimal, your method won't work. That is not to say that it won't work entirely, but it won't work for the one case where the page number goes up to 10. Therefore, we will have to go with the perpetual thorn or the longer, less popular method which is only really an option if we're dealing with integers, which we are. I've thus decided to list out the two sensible ways it could be done (and work for page 10 too).
The nice way

Code:
"?
For(B,1,1+log(A
   sub("0123456789",iPart(10fPart(A10^(~B)))+1,1)+Ans
End
"page."+sub(Ans,1,length(Ans)-1)+",6x6→Str1

The ugly (but smaller) way that overwrites a lot more variables

Code:
{0,1→L₁
{0,A→L₂
LinReg(ax+b) Y₁
Equ►String(Y₁,Str1
"page."+sub(Str1,1,length(Str1)-3)+",6x6→Str1
I am going to start this program over from (almost) scratch [because my code is old and abysmal], so i will post code and or screenshots once i make progress Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement