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
Calculator Programming 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.
General Coding and Design =>
Calculator Programming
Author |
Message |
|
Ph34r_my_l33t_skillz
Advanced Member
Joined: 09 Oct 2007 Posts: 339
|
Posted: 08 Oct 2008 07:34:07 pm Post subject: |
|
|
I know Pascal is one of the oldest languages out there, but I'm learning it in school, and I wanted to make a Rubik's Cube solver. I'm having problems with storing the user input to an array. Here's the part of the code that's giving the error:
Code: c:=readkey; {c is the color input by the user on the messed up cube}
cube[cnt2]:=c; {cube is the array, and cnt2 is the variable for which slot in the array to put c in}
I know it's not very descriptive, but can anyone help me? I'd be glad to give more information on the code itself, if it would help. Thanks!
Edit: oh yeah, and the error is "Error 26: Type Mismatch"
Last edited by Guest on 08 Oct 2008 07:35:16 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 08 Oct 2008 09:02:39 pm Post subject: |
|
|
My guess is that readkey returns a character but your array contains numbers. |
|
Back to top |
|
|
Ph34r_my_l33t_skillz
Advanced Member
Joined: 09 Oct 2007 Posts: 339
|
Posted: 09 Oct 2008 03:26:52 pm Post subject: |
|
|
DarkerLine wrote: My guess is that readkey returns a character but your array contains numbers.
[post="127719"]<{POST_SNAPBACK}>[/post]
ahh, thanks. I tried it and it works now.
The only other problem I'm having for the time being is another array problem. Is there a way to sort an array of real numbers in ascending order? I can't find any built in command, so do I have to sort it manually?
Last edited by Guest on 09 Oct 2008 03:27:02 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 09 Oct 2008 04:18:05 pm Post subject: |
|
|
A basic bubble sort would take five lines of code and two minutes to write. Unless it's a really frickin huge array, you don't really have to worry about any more advanced algorithms, although they are good programming practice in any case. |
|
Back to top |
|
|
Ph34r_my_l33t_skillz
Advanced Member
Joined: 09 Oct 2007 Posts: 339
|
Posted: 09 Oct 2008 04:19:25 pm Post subject: |
|
|
When you say "frickin huge array", how big would that be? Cause the array I'm sorting is about 50 numbers. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 09 Oct 2008 04:21:41 pm Post subject: |
|
|
50 numbers is definitely small enough not to worry about which algorithm to use. I think you'd be noticing a difference between algorithms at 1000 or so elements? |
|
Back to top |
|
|
Ph34r_my_l33t_skillz
Advanced Member
Joined: 09 Oct 2007 Posts: 339
|
Posted: 09 Oct 2008 04:49:41 pm Post subject: |
|
|
OK, then. I'll try it out, and let you know how it goes. |
|
Back to top |
|
|
MSR5
Newbie
Joined: 22 Jun 2008 Posts: 49
|
Posted: 15 Oct 2008 02:31:37 am Post subject: |
|
|
the algorithms I have seen for rubric cube solvers that are somewhat decant are extremely complicated and slow, so how do you plan on making yours?
Also why not just use C, it is a much easier programing language and you would probably not be having these problems. |
|
Back to top |
|
|
Ph34r_my_l33t_skillz
Advanced Member
Joined: 09 Oct 2007 Posts: 339
|
Posted: 15 Oct 2008 06:10:41 pm Post subject: |
|
|
I am using a pretty complicated method. I think the algorithms used are somewhat similar to the ones used in the one for the calculator (can't remember who made it).
I don't know C or C++ yet, so I'm starting with pascal. Mostly cause it's so similar to TI-BASIC. |
|
Back to top |
|
|
|
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