This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
Flofloflo


Member


Joined: 07 Nov 2007
Posts: 120

Posted: 17 Sep 2009 12:57:48 pm    Post subject:

Because of the reactions on my other game, I decided I could put at least one more on here.
A Slide Puzzle! You are the white spot, if you press the arrow keys you swap the white spot with a number. You have to shuffle yourself (Hey, it's not different from real slide puzzles in that sense!). Press enter when you are done fixing your puzzle.


Code:
Clrhome
Output)2,1,"SIZE?"
Prompt F
{F,F->Dim([A]
Clrhome
For(A,1,F
For(B,1,F
B+A(F-1->[A](A,B
Output(A,2B-1,[A](A,B
End:End
Output(F,2F-1,"  ";;DOUBLE SPACE!!!
F->A
A->B
0->M;; If you don't want the game to count your 'shuffle moves' you can change this into -20 for example, so you have 20 free moves to shuffle

;; So far the set-up

While 1
B->G
A->D
0
Repeat Ans
Getkey
End
Ans->E
Output(8,1,M
A+(Ans=26)-(Ans=24
If Ans and Ans<(F+1
Ans->A
M+1->M
B+(E=34)-(E=25
If Ans and Ans<F+1
Ans->B
[A](B,A->[A](G,D
0->[A](B,A
If [A](G,D
Output(G,2D-1,[A](G,D
Output(B,2A-1,"  ";; TWO SPACES!
If E!=105
End

;; Here the game ends, and victory check is done.

0
For(A,1,F
For(B,1,F
Ans + ([A](A,B)=(B+A(F-1
End
End
If Ans = (F^2-1
Output(1,1,"CONGRATZ


Last edited by Guest on 18 Sep 2009 03:41:23 pm; edited 1 time in total
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 17 Sep 2009 09:07:13 pm    Post subject:

Fun game, aside from the fact it took me 15 minutes to type it in. By the way the max size is 6.

I just solved a size 5 puzzle. It took about 12 minutes of playing straight and 1643 moves.

You make cool games Flofloflo. Smile


Last edited by Guest on 17 Sep 2009 09:07:53 pm; edited 1 time in total
Back to top
Flofloflo


Member


Joined: 07 Nov 2007
Posts: 120

Posted: 18 Sep 2009 03:52:21 am    Post subject:

Thanks.
It's a bit long, but like I said, if I'd make a new version (I hope I find the time for it) I could probably make it 3 times smaller.
Also, if you want a bigger matrix, you can just add a few symbols to the string "1234567890abcdefghijklmnopqrstuvwxyz"

-Floris
Edit: Done, no shuffle system, and barely two times smaller, but anyways, I changed the entire concept. Your 'cursor' is now simply the empty place, and if you move you automatically swap with the adjacent square. Press Enter to check indicate your victory.

Quote:
Clrhome
Output)2,1,"SIZE?"
Prompt F
{F,F->Dim([A]
Clrhome
For(A,1,F
For(B,1,F
B+A(F-1->[A](A,B
Output(A,2B-1,[A](A,B
End:End
Output(F,2F-1," " ;;DOUBLE SPACE!!!
F->A
A->B
0->M

;; So far the set-up

While 1
B->G
A->D
0
Repeat Ans
Getkey
End
Ans->E
Output(8,1,M
A+(Ans=26)-(Ans=24
If Ans and Ans<(F+1
Ans->A
M+1->M
B+(E=34)-(E=25
If Ans and Ans<F+1
Ans->B
[A](B,A->[A](G,D
0->[A](B,A
If [A](G,D
Output(G,2D-1,[A](G,D
Output(B,2A-1," " ;; TWO SPACES!
If E!=105
End

;; Here the game ends, and victory check is done.

0
For(A,1,F
For(B,1,F
Ans + ([A](A,B )=(B+A(F-1
End
End
If Ans = (F^2-1
Output(1,1,"CONGRATZ


Last edited by Guest on 18 Sep 2009 03:37:33 pm; edited 1 time in total
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 18 Sep 2009 06:47:34 pm    Post subject:

Flofloflo wrote:
Also, if you want a bigger matrix, you can just add a few symbols to the string "1234567890abcdefghijklmnopqrstuvwxyz"
Lol, I already did that! Smile
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement