Sign in to follow this  
Followers 0
onedayillpay

rubic cube

11 posts in this topic

#1 ·  Posted (edited)

im looking for some help on this rubic cube...

you will need my rubic cube folder...

CODE
#include <GuiConstants.au3>

$gui=GUICreate("rubic cube", 600, 500)

$pic=GuiCreate("MyGUI", 500, 500,-1, -1,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)

GUISetState(@SW_SHOW,$pic)

GUISetState(@SW_SHOW,$gui)

$picPos = WinGetPos($pic)

$guiPos = WinGetPos($gui)

$flatW = 56 ;>>>>>>>>>>>>>>>>>>>>

$flatH = 10

$sidesW = 10 ; size

$sidesH = 56

$middleWH = 49;>>>>>>>>>>>>>>>>>>

;.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> blue shape

$bluelocationFLAT = (@ScriptDir&"\colors\blue\flat.gif")

$bluelocationMIDDLE = (@ScriptDir&"\colors\blue\middle.gif")

$bluelocationSIDES = (@ScriptDir&"\colors\blue\sides.gif")

;$flatblue = GuiCtrlCreatePic($bluelocationFLAT, 90, 48, $flatW, $flatH)

;$middleblue = GuiCtrlCreatePic($bluelocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidesblue = GuiCtrlCreatePic($bluelocationSIDES, 50, 50, $sidesW, $sidesH)

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< red shape

$redlocationFLAT = (@ScriptDir&"\colors\red\flat.gif")

$redlocationMIDDLE = (@ScriptDir&"\colors\red\middle.gif")

$redlocationSIDES = (@ScriptDir&"\colors\red\sides.gif")

;$flatred = GuiCtrlCreatePic($redlocationFLAT, 90, 48, $flatW, $flatH)

;$middlered = GuiCtrlCreatePic($redlocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidesbred = GuiCtrlCreatePic($redlocationSIDES, 50, 50, $sidesW, $sidesH)

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> yellow shape

$yellowlocationFLAT = (@ScriptDir&"\colors\yellow\flat.gif")

$yellowlocationMIDDLE = (@ScriptDir&"\colors\yellow\middle.gif")

$yellowlocationSIDES = (@ScriptDir&"\colors\yellow\sides.gif")

;$flatyellow = GuiCtrlCreatePic($yellowlocationFLAT, 90, 48, $flatW, $flatH)

;$middleyellow = GuiCtrlCreatePic($yellowlocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidesyellow = GuiCtrlCreatePic($yellowlocationSIDES, 50, 50, $sidesW, $sidesH)

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< green shape

$greenlocationFLAT = (@ScriptDir&"\colors\green\flat.gif")

$greenlocationMIDDLE = (@ScriptDir&"\colors\green\middle.gif")

$greenlocationSIDES = (@ScriptDir&"\colors\green\sides.gif")

;$flatgreen = GuiCtrlCreatePic($greenlocationFLAT, 90, 48, $flatW, $flatH)

;$middlegreen = GuiCtrlCreatePic($greenlocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidesgreen = GuiCtrlCreatePic($greenlocationSIDES, 50, 50, $sidesW, $sidesH)

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> purple shape

$purplelocationFLAT = (@ScriptDir&"\colors\purple\flat.gif")

$purplelocationMIDDLE = (@ScriptDir&"\colors\purple\middle.gif")

$purplelocationSIDES = (@ScriptDir&"\colors\purple\sides.gif")

;$flatpurple = GuiCtrlCreatePic($purplelocationFLAT, 90, 48, $flatW, $flatH)

;$middlepurple = GuiCtrlCreatePic($purplelocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidespurple = GuiCtrlCreatePic($purplelocationSIDES, 50, 50, $sidesW, $sidesH)

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< grey shape

$greylocationFLAT = (@ScriptDir&"\colors\grey\flat.gif")

$greylocationMIDDLE = (@ScriptDir&"\colors\grey\middle.gif")

$greylocationSIDES = (@ScriptDir&"\colors\grey\sides.gif")

;$flatgrey = GuiCtrlCreatePic($greylocationFLAT, 90, 48, $flatW, $flatH)

;$middlegrey = GuiCtrlCreatePic($greylocationMIDDLE, 100, 60, $middleWH, $middleWH)

;$sidesgrey = GuiCtrlCreatePic($greylocationSIDES, 50, 50, $sidesW, $sidesH)

;Defalt cube starts

$13_Left = 100

$13_Top = 62

$13 = GuiCtrlCreatePic($bluelocationMIDDLE, $13_Left, $13_Top, $middleWH, $middleWH)

$14_let = 154

$14_top = 62

$14 = GuiCtrlCreatePic($bluelocationMIDDLE, $14_let, $14_top, $middleWH, $middleWH)

$15_left = 208

$15_top = 62

$15 = GuiCtrlCreatePic($bluelocationMIDDLE, $15_left, $15_top, $middleWH, $middleWH)

$19_left = 100

$19_top = 116

$19 = GuiCtrlCreatePic($bluelocationMIDDLE, $19_left, $19_top, $middleWH, $middleWH)

$20_left = 154

$20_top = 116

$20 = GuiCtrlCreatePic($bluelocationMIDDLE, $20_left, $20_top, $middleWH, $middleWH)

$21_left = 208

$21_top = 116

$21 = GuiCtrlCreatePic($bluelocationMIDDLE, $21_left, $21_top, $middleWH, $middleWH)

$25_left = 100

$25_top = 170

$25 = GuiCtrlCreatePic($bluelocationMIDDLE, $25_left, $25_top, $middleWH, $middleWH)

$26_left = 154

$26_top = 170

$26 = GuiCtrlCreatePic($bluelocationMIDDLE, $26_left, $26_top, $middleWH, $middleWH)

$27_left = 208

$27_top = 170

$27 = GuiCtrlCreatePic($bluelocationMIDDLE, $27_left, $27_top, $middleWH, $middleWH)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$1_left = 66

$1_top = 24

$1 = GuiCtrlCreatePic($greenlocationFLAT, $1_left, $1_top, $flatW, $flatH)

$2_left = 121

$2_top = 24

$2 = GuiCtrlCreatePic($greenlocationFLAT, $2_left, $2_top, $flatW, $flatH)

$3_left = 176

$3_top = 24

$3 = GuiCtrlCreatePic($greenlocationFLAT, $3_left, $3_top, $flatW, $flatH)

$4_left = 78

$4_top = 36

$4 = GuiCtrlCreatePic($greenlocationFLAT, $4_left, $4_top, $flatW, $flatH)

$5_left = 133

$5_top = 36

$5 = GuiCtrlCreatePic($greenlocationFLAT, $5_left, $5_top, $flatW, $flatH)

$6_left = 188

$6_top = 36

$6 = GuiCtrlCreatePic($greenlocationFLAT, $6_left, $6_top, $flatW, $flatH)

$7_left = 90

$7_top = 48

$7 = GuiCtrlCreatePic($greenlocationFLAT, $7_left, $7_top, $flatW, $flatH)

$8_left = 145

$8_top = 48

$8 = GuiCtrlCreatePic($greenlocationFLAT, $8_left, $8_top, $flatW, $flatH)

$9_left = 200

$9_top = 48

$9 = GuiCtrlCreatePic($greenlocationFLAT, $9_left, $9_top, $flatW, $flatH)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$12_left = 85

$12_top = 53

$12 = GuiCtrlCreatePic($greylocationSIDES, $12_left, $12_top, $sidesW, $sidesH)

$18_left = 85

$18_top = 108

$18 = GuiCtrlCreatePic($greylocationSIDES, $18_left, $18_top, $sidesW, $sidesH)

$24_left = 85

$24_top = 163

$24 = GuiCtrlCreatePic($greylocationSIDES, $24_left, $24_top, $sidesW, $sidesH)

$11_left = 72

$11_top = 41

$11 = GuiCtrlCreatePic($greylocationSIDES, $11_left, $11_top, $sidesW, $sidesH)

$17_left = 73

$17_top = 96

$17 = GuiCtrlCreatePic($greylocationSIDES, $17_left, $17_top, $sidesW, $sidesH)

$23_left = 73

$23_top = 151

$23 = GuiCtrlCreatePic($greylocationSIDES, $23_left, $23_top, $sidesW, $sidesH)

$10_left = 61

$10_top = 29

$10 = GuiCtrlCreatePic($greylocationSIDES, $10_left, $10_top, $sidesW, $sidesH)

$16_left = 61

$16_top = 84

$16 = GuiCtrlCreatePic($greylocationSIDES, $16_left, $16_top, $sidesW, $sidesH)

$22_left = 61

$22_top = 139

$22 = GuiCtrlCreatePic($greylocationSIDES, $22_left, $22_top, $sidesW, $sidesH)

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$28_left = 349

$28_top = 25

$28 = GuiCtrlCreatePic($redlocationMIDDLE, $28_left, $28_top, $middleWH, $middleWH)

$29_left = 403

$29_top = 25

$29 = GuiCtrlCreatePic($redlocationMIDDLE, $29_left, $29_top, $middleWH, $middleWH)

$30_left = 457

$30_top = 25

$30 = GuiCtrlCreatePic($redlocationMIDDLE, $30_left, $30_top, $middleWH, $middleWH)

$34_left = 349

$34_top = 79

$34 = GuiCtrlCreatePic($redlocationMIDDLE, $34_left, $34_top, $middleWH, $middleWH)

$35_left = 403

$35_top = 79

$35 = GuiCtrlCreatePic($redlocationMIDDLE, $35_left, $35_top, $middleWH, $middleWH)

$36_left = 457

$36_top = 79

$36 = GuiCtrlCreatePic($redlocationMIDDLE, $36_left, $36_top, $middleWH, $middleWH)

$40_left = 349

$40_top = 133

$40 = GuiCtrlCreatePic($redlocationMIDDLE, $40_left, $40_top, $middleWH, $middleWH)

$41_left = 403

$41_top = 133

$41 = GuiCtrlCreatePic($redlocationMIDDLE, $41_left, $41_top, $middleWH, $middleWH)

$42_left = 457

$42_top = 133

$42 = GuiCtrlCreatePic($redlocationMIDDLE, $42_left, $42_top, $middleWH, $middleWH)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$52_left = 375

$52_top = 209

$52 = GuiCtrlCreatePic($yellowlocationFLAT, $52_left, $52_top, $flatW, $flatH)

$53_left = 430

$53_top = 209

$53 = GuiCtrlCreatePic($yellowlocationFLAT, $53_left, $53_top, $flatW, $flatH)

$54_left = 485

$54_top = 209

$54 = GuiCtrlCreatePic($yellowlocationFLAT, $54_left, $54_top, $flatW, $flatH)

$49_left = 363

$49_top = 197

$49 = GuiCtrlCreatePic($yellowlocationFLAT, $49_left, $49_top, $flatW, $flatH)

$50_left = 418

$50_top = 197

$50 = GuiCtrlCreatePic($yellowlocationFLAT, $50_left, $50_top, $flatW, $flatH)

$51_left = 473

$51_top = 197

$51 = GuiCtrlCreatePic($yellowlocationFLAT, $51_left, $51_top, $flatW, $flatH)

$46_left = 351

$46_top = 185

$46 = GuiCtrlCreatePic($yellowlocationFLAT, $46_left, $46_top, $flatW, $flatH)

$47_left = 406

$47_top = 185

$47 = GuiCtrlCreatePic($yellowlocationFLAT, $47_left, $47_top, $flatW, $flatH)

$48_left = 461

$48_top = 185

$48 = GuiCtrlCreatePic($yellowlocationFLAT, $48_left, $48_top, $flatW, $flatH)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$33_left = 535

$33_top = 48

$33 = GuiCtrlCreatePic($purplelocationSIDES, $33_left,$33_top, $sidesW, $sidesH)

$39_left = 535

$39_top = 103

$39 = GuiCtrlCreatePic($purplelocationSIDES, $39_left, $39_top, $sidesW, $sidesH)

$45_left = 535

$45_top = 158

$45 = GuiCtrlCreatePic($purplelocationSIDES, $45_left, $45_top, $sidesW, $sidesH)

$32_left = 523

$32_top = 36

$32 = GuiCtrlCreatePic($purplelocationSIDES, $32_left, $32_top, $sidesW, $sidesH)

$38_left = 523

$38_top = 91

$38 = GuiCtrlCreatePic($purplelocationSIDES, $38_left, $38_top, $sidesW, $sidesH)

$44_left = 523

$44_top = 146

$44 = GuiCtrlCreatePic($purplelocationSIDES, $44_left, $44_top, $sidesW, $sidesH)

$31_left = 511

$31_top = 24

$31 = GuiCtrlCreatePic($purplelocationSIDES, $31_left, $31_top, $sidesW, $sidesH)

$37_left = 511

$37_top = 79

$37 = GuiCtrlCreatePic($purplelocationSIDES, $37_left, $37_top, $sidesW, $sidesH)

$43_left = 511

$43_top = 134

$43 = GuiCtrlCreatePic($purplelocationSIDES, $43_left, $43_top, $sidesW, $sidesH)

$Button_1 = GuiCtrlCreateButton("1", 120, 230, 20, 20)

$Button_2 = GuiCtrlCreateButton("2", 120, 255, 20, 20)

$Button_3 = GuiCtrlCreateButton("", 170, 230, 20, 20)

$Button_4 = GuiCtrlCreateButton("", 170, 255, 20, 20)

$Button_5 = GuiCtrlCreateButton("", 220, 255, 20, 20)

$Button_6 = GuiCtrlCreateButton("", 220, 230, 20, 20)

$Button_7 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_8 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_9 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_10 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_11 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_12 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_13 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_14 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_15 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_16 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_17 = GuiCtrlCreateButton("", 20, 230, 20, 20)

$Button_18 = GuiCtrlCreateButton("", 20, 230, 20, 20)

GUISetBkColor (0x000000)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

$1 = GuiCtrlCreatePic($bluelocationFLAT, $1_left, $1_top, $flatW, $flatH)

$4 = GuiCtrlCreatePic($bluelocationFLAT, $4_left, $4_top, $flatW, $flatH)

$7 = GuiCtrlCreatePic($bluelocationFLAT, $7_left, $7_top, $flatW, $flatH)

$13 = GuiCtrlCreatePic($yellowlocationMIDDLE, $13_Left, $13_Top, $middleWH, $middleWH)

$19 = GuiCtrlCreatePic($yellowlocationMIDDLE, $19_left, $19_top, $middleWH, $middleWH)

$25 = GuiCtrlCreatePic($yellowlocationMIDDLE, $25_left, $25_top, $middleWH, $middleWH)

GUICtrlSetPos($1, $1_left, $1_top)

GUICtrlSetPos($4, $4_left, $4_top)

GUICtrlSetPos($7, $7_left, $7_top)

GUICtrlSetPos($13, $13_left, $13_top)

GUICtrlSetPos($19, $19_left, $19_top)

GUICtrlSetPos($25, $25_left, $25_top)

$28 = GuiCtrlCreatePic($greenlocationMIDDLE, $28_left, $28_top, $middleWH, $middleWH)

$34 = GuiCtrlCreatePic($greenlocationMIDDLE, $34_left, $34_top, $middleWH, $middleWH)

$40 = GuiCtrlCreatePic($greenlocationMIDDLE, $40_left, $40_top, $middleWH, $middleWH)

$46 = GuiCtrlCreatePic($redlocationFLAT, $46_left, $46_top, $flatW, $flatH)

$49 = GuiCtrlCreatePic($redlocationFLAT, $49_left, $49_top, $flatW, $flatH)

$52 = GuiCtrlCreatePic($redlocationFLAT, $52_left, $52_top, $flatW, $flatH)

GUICtrlSetPos($28, $28_left, $28_top)

GUICtrlSetPos($34, $34_left, $34_top)

GUICtrlSetPos($40, $40_left, $40_top)

GUICtrlSetPos($46, $46_left, $46_top)

GUICtrlSetPos($49, $49_left, $49_top)

GUICtrlSetPos($52, $52_left, $52_top)

Case $msg = $Button_2

$1 = GuiCtrlCreatePic($greenlocationFLAT, $1_left, $1_top, $flatW, $flatH)

$4 = GuiCtrlCreatePic($greenlocationFLAT, $4_left, $4_top, $flatW, $flatH)

$7 = GuiCtrlCreatePic($greenlocationFLAT, $7_left, $7_top, $flatW, $flatH)

$13 = GuiCtrlCreatePic($bluelocationMIDDLE, $13_Left, $13_Top, $middleWH, $middleWH)

$19 = GuiCtrlCreatePic($bluelocationMIDDLE, $19_left, $19_top, $middleWH, $middleWH)

$25 = GuiCtrlCreatePic($bluelocationMIDDLE, $25_left, $25_top, $middleWH, $middleWH)

GUICtrlSetPos($1, $1_left, $1_top)

GUICtrlSetPos($4, $4_left, $4_top)

GUICtrlSetPos($7, $7_left, $7_top)

GUICtrlSetPos($13, $13_left, $13_top)

GUICtrlSetPos($19, $19_left, $19_top)

GUICtrlSetPos($25, $25_left, $25_top)

$28 = GuiCtrlCreatePic($redlocationMIDDLE, $28_left, $28_top, $middleWH, $middleWH)

$34 = GuiCtrlCreatePic($redlocationMIDDLE, $34_left, $34_top, $middleWH, $middleWH)

$40 = GuiCtrlCreatePic($redlocationMIDDLE, $40_left, $40_top, $middleWH, $middleWH)

$46 = GuiCtrlCreatePic($yellowlocationFLAT, $46_left, $46_top, $flatW, $flatH)

$49 = GuiCtrlCreatePic($yellowlocationFLAT, $49_left, $49_top, $flatW, $flatH)

$52 = GuiCtrlCreatePic($yellowlocationFLAT, $52_left, $52_top, $flatW, $flatH)

GUICtrlSetPos($28, $28_left, $28_top)

GUICtrlSetPos($34, $34_left, $34_top)

GUICtrlSetPos($40, $40_left, $40_top)

GUICtrlSetPos($46, $46_left, $46_top)

GUICtrlSetPos($49, $49_left, $49_top)

GUICtrlSetPos($52, $52_left, $52_top)

EndSelect

WEnd

Exit

this is so complicated to explain my problem....

in order for this to work the program has to remember were every spot is and was...

im not sure how i can do this... i could go threw and use about 1500 "Elseif $number = $spot1 Then" but that would take a big brain...

can you guys throw out some ideas, I got tuns

rubic_cube.rar

Edited by onedayillpay

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

http://www.autoitscript.com/forum/index.ph...297&hl=game

if you look at this lame game i made and test it out for a few mins you will see that the script remembers were you left off...

i was thinking i would want to for sure use that same consept on this cube...

and for the lame game having 1300 lines of code is way too much for a such a little game, if i was to script this cube in the same manner as the lame game then 10'000 lines of code for this cube would kill me...

i do things the hard way...

Edited by onedayillpay

Share this post


Link to post
Share on other sites

Why are there two cubes? Back and front... I have played your game. So whats your problem if it already remembers it?

Rubic's cube script will be long. Its a mind game, which requires probabillity and stuff like that :whistle:

Share this post


Link to post
Share on other sites

My god ... this looks like so much fun... but :whistle: lol.

I have a Huge suggestion.

Take a few hours to learn arrays and implement them, you'll hate me when you start, and probably be as stubborn as Volly was, but you'll grow to appreciate not having to write 2500 extra lines of code.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

My god ... this looks like so much fun... but :whistle: lol.

I have a Huge suggestion.

Take a few hours to learn arrays and implement them, you'll hate me when you start, and probably be as stubborn as Volly was, but you'll grow to appreciate not having to write 2500 extra lines of code.

can you give me a few examples

Share this post


Link to post
Share on other sites

can you give me a few examples

Of an array? Sure, just look up any thread I've created in the Example forum, I believe I've used them with most if not all the UDFs I've posted there.

You might want to look at this as well and study in detail, I believe Uten gave some good advice toward the bottom of that thread:

http://www.autoitscript.com/forum/index.php?showtopic=38273

He's also got a link to a site explaining arrays, I don't have the link nor do I know the thread he posted it in, but maybe if he reads this, he'll share it with us.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Yep you deffently start using arrays... Would make you prgram more flexible and you would easy change a setting... Arrays and Loops... those two are the best when doing things like you try to... (by the way personal record 48 sec... on screen 2 min)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0