Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
26 May, 2013, 08:27:40 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: 15 number tile game thing c3 editition -  (Read 1098 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Geekboy1011
The Oneironaut
Support Staff
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 04:37:11
Date Registered: 11 June, 2009, 01:27:44
Location: Buried in cherry flavored source code
Posts: 1503


Topic starter
Total Post Ratings: +88

View Profile
« on: 10 April, 2010, 07:23:19 »
0

ok well to learn matrices for crimson i took on a hopefully small side project which is a 15 number slider game
but alas im having a few issues most notably with shuffling the board

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
:Disp "SIZE?"
:Input X // Adds a "?" but its your choice
:1→C
:DelVar ADelVar B{X,X→dim([J]
:For(A,1,X
:For(B,1,X
:C→[J](A,B
:C+1→C
:End:End
:1→B
:X+X/10^(1+int(log(X→l   // Make sure 10^( is one token
:Pause L
:0→[J](X,X
:ClrHome
:For(θ,B,100
:Output(1,1,B
:Output(6,6,C
:Output(4,4,det(4,0
:C→n
:0→C
:Repeat C≠n
:randInt(1,4→C
:End
:If C=1 and .1≠fPart(L:Then  // Rearranged second term
:‾1→M:Goto UD:End
:If C=2 and X≠iPart(L:Then
:1→M:Goto LR:End
:If C=3 and (X/10)≠fPart(L:Then
:1→M:Goto UD:End
:If C=4 and 1≠iPart(L:Then
:‾1→M:Goto LR:End
:End
:Lbl UD
:[J](iPart(L),10fPart(L→A
:[J](iPart(L),10fPart(L+M→[J](iPart(L),10fPart(L
:A→[J](iPart(L),M+10fPart(L
:L+M/10→L
:B+1→B
:End
:End
:Lbl LR
:[J](iPart(L),10fPart(L→A
:[J](iPart(L)+M,10fPart(L→[J](iPart(L),10fPart(L
:A→[J](iPart(L)+M,10fPart(L
:L+M→L
:B+1→B
:End
:End
:Disp [J]
* Geekboy1011 thanks sirCmpwn for optimizations

well my problem with the current code is my shufle routine is  to slow and inaccurate to say the least not always providing a good shuffle Undecided

so yeah my question is any one know a better shuffle routine ??

restrictions on the routine

1 cant just be randomly placed as it will be a 50 50 chance of a unsolvable puzzle


i need some help please and thank you
« Last Edit: 10 April, 2010, 07:26:16 by Geekboy1011 » Logged

Yumé - The Eternal Dreams(tsukasaZX's project): music making working on second piece
PROJECT:TiX - planning stages almost done few more things to think about then i start coding so coding should commence tommorow or the NULL of NULL yay
Project/Mod Cadan: CD  -   My (first?!?) mod of the cadan engine for a not so demoified version of the game : HOLD :Is here
Beta testing: -  Correlation: Wordwrap abuse IF Adventure style
cooliojazz
Support Staff
LV7 Elite (Next: 700)
*
Offline Offline

Gender: Male
Last Login: Today at 06:52:23
Date Registered: 23 May, 2009, 19:28:11
Location: Colorado, USA
Posts: 614


Total Post Ratings: +52

View Profile WWW
« Reply #1 on: 10 April, 2010, 08:39:50 »
0

Well, I'm not sure how the heck yours works, and i got lots of syntax errors and stuffs, but after "fixing" it i think this runs faster:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
:Input "?x? ",θ
:{θ,θ→dim([A]
:0→C
:For(A,1,θ
:For(B,1,θ
:C→[A](A,B
:C+1→C
:End
:End
:Disp [A]
:1→X:1→Y
:For(A,1,θ2
:randInt(1,4→B
:X→W:Y→Z
:Repeat X≠W or Y≠Z
:randInt(1,4→B
:X+(B=3)-(B=1→X
:Y+(B=4)-(B=2→Y
:X+(X=0)-(X=θ+1→X
:Y+(Y=0)-(Y=θ+1→Y
:End
:[A](Z,W→C
:[A](Y,X→[A](Z,W
:C→[A](Y,X
:End
:Disp [A]
thats what you want right?  It just shuffles it?  This does it only as many times as there are peices, cause past that it's a bit pointless... and i changed the first tile to "0" to represent the blank tile...
Logged

Spoiler for Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."



TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here
The Rest Should Be Here (Bandcamp)
SirCmpwn
Guest
« Reply #2 on: 10 April, 2010, 16:37:22 »
0

Here is an example of how to suffle L1 using the Fisher-Yates algorithm:

1
2
3
4
5
6
7
dim(L1→N
For(I,1,N
randInt(I,N→A
L1(A→B
L1(I→L(A
B→L1(I
End

A faster method would be to do this (stolen from Weregoose):

1
2
rand(dim(L1→L2
SortA(L2,L1
« Last Edit: 10 April, 2010, 16:42:15 by SirCmpwn » Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:37:00
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50238


Total Post Ratings: +2615

View Profile WWW
« Reply #3 on: 10 April, 2010, 19:19:14 »
0

Interesting it would remind me of the mini game in Final Fantasy 1.

I wonder if in future versions it could have support for bigger shuffle boards like 5x5 and 6x6?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 07:41:43
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5644


Total Post Ratings: +589

View Profile
« Reply #4 on: 10 April, 2010, 19:56:20 »
0

Here is an example of how to suffle L1 using the Fisher-Yates algorithm:

1
2
3
4
5
6
7
dim(L1→N
For(I,1,N
randInt(I,N→A
L1(A→B
L1(I→L(A
B→L1(I
End

A faster method would be to do this (stolen from Weregoose):

1
2
rand(dim(L1→L2
SortA(L2,L1

Remember to Sir, you cant just randomize the tiles around because exactly half of all combinations cannot be solved.
Logged

SirCmpwn
Guest
« Reply #5 on: 10 April, 2010, 19:57:51 »
0

Here, take a look at this thread:
http://www.unitedti.org/forum/index.php?showtopic=4685&st=0&p=134765&hl=shuffle&fromsearch=1&#entry134765

They talk about how to shuffle only solvable shuffles.
Logged
Geekboy1011
The Oneironaut
Support Staff
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 04:37:11
Date Registered: 11 June, 2009, 01:27:44
Location: Buried in cherry flavored source code
Posts: 1503


Topic starter
Total Post Ratings: +88

View Profile
« Reply #6 on: 10 April, 2010, 22:56:22 »
0

hmm  ty all so much i havent tried coolio's methosd yet stil going to try

@sir im shuffling a matrix not a list X.x so im not sure how those routines would work X.x
« Last Edit: 10 April, 2010, 22:58:24 by Geekboy1011 » Logged

Yumé - The Eternal Dreams(tsukasaZX's project): music making working on second piece
PROJECT:TiX - planning stages almost done few more things to think about then i start coding so coding should commence tommorow or the NULL of NULL yay
Project/Mod Cadan: CD  -   My (first?!?) mod of the cadan engine for a not so demoified version of the game : HOLD :Is here
Beta testing: -  Correlation: Wordwrap abuse IF Adventure style
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:37:00
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50238


Total Post Ratings: +2615

View Profile WWW
« Reply #7 on: 11 April, 2010, 05:42:33 »
0

Mhmm, what would be the equivalent for matrices? I never actually messed around with shuffling. Else another method would be to switch to lists, but that means some more calculations in the code since a list is in one row
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Geekboy1011
The Oneironaut
Support Staff
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 04:37:11
Date Registered: 11 June, 2009, 01:27:44
Location: Buried in cherry flavored source code
Posts: 1503


Topic starter
Total Post Ratings: +88

View Profile
« Reply #8 on: 11 April, 2010, 05:44:45 »
0

im thinking of fliiping over to a list actually found a nice and by the looks of it fast shuffle routine Big smile

http://omnimaga.pastebin.com/BzxgrEMr

although there has to be some kinnd of algoritm to it or if im real lazy just shuffle the list and then make it a matrix Big smile
Logged

Yumé - The Eternal Dreams(tsukasaZX's project): music making working on second piece
PROJECT:TiX - planning stages almost done few more things to think about then i start coding so coding should commence tommorow or the NULL of NULL yay
Project/Mod Cadan: CD  -   My (first?!?) mod of the cadan engine for a not so demoified version of the game : HOLD :Is here
Beta testing: -  Correlation: Wordwrap abuse IF Adventure style
meishe91
Super Ninja
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 02 May, 2013, 23:54:14
Date Registered: 05 March, 2010, 05:39:48
Posts: 2965


Total Post Ratings: +102

View Profile WWW
« Reply #9 on: 11 April, 2010, 06:02:24 »
0

Well if you need I could make you a list to matrix program.
Logged





For the 51st time, that is not my card! (Magic Joke)
Geekboy1011
The Oneironaut
Support Staff
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 04:37:11
Date Registered: 11 June, 2009, 01:27:44
Location: Buried in cherry flavored source code
Posts: 1503


Topic starter
Total Post Ratings: +88

View Profile
« Reply #10 on: 11 April, 2010, 06:20:09 »
0

ty but no thanks a simpleish for loop will suffice ^_^

still need to test that on calc though for speed so yeah Big smile
Logged

Yumé - The Eternal Dreams(tsukasaZX's project): music making working on second piece
PROJECT:TiX - planning stages almost done few more things to think about then i start coding so coding should commence tommorow or the NULL of NULL yay
Project/Mod Cadan: CD  -   My (first?!?) mod of the cadan engine for a not so demoified version of the game : HOLD :Is here
Beta testing: -  Correlation: Wordwrap abuse IF Adventure style
meishe91
Super Ninja
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 02 May, 2013, 23:54:14
Date Registered: 05 March, 2010, 05:39:48
Posts: 2965


Total Post Ratings: +102

View Profile WWW
« Reply #11 on: 11 April, 2010, 06:48:49 »
0

Well ya I know Tongue I just meant I could write code to do it because it'd be similar to my list to string routine.
Logged





For the 51st time, that is not my card! (Magic Joke)
willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 01:21:23
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2638


Total Post Ratings: +66

View Profile
« Reply #12 on: 13 April, 2010, 05:36:53 »
0

I think solvable algorithms would be a good idea. Otherwise, people would complain.

Eventually, made you could add picture support! If you used XLib or Celtic III I imagine a sprite could fit into each tile quite easily.
Logged

Geekboy1011
The Oneironaut
Support Staff
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 04:37:11
Date Registered: 11 June, 2009, 01:27:44
Location: Buried in cherry flavored source code
Posts: 1503


Topic starter
Total Post Ratings: +88

View Profile
« Reply #13 on: 13 April, 2010, 05:39:00 »
0

i am planning to add picture support ^_^

by algorithems i meant a way to check to see if the generated grid is valid at the start than using a shuffle
Logged

Yumé - The Eternal Dreams(tsukasaZX's project): music making working on second piece
PROJECT:TiX - planning stages almost done few more things to think about then i start coding so coding should commence tommorow or the NULL of NULL yay
Project/Mod Cadan: CD  -   My (first?!?) mod of the cadan engine for a not so demoified version of the game : HOLD :Is here
Beta testing: -  Correlation: Wordwrap abuse IF Adventure style
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.259 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.