Lol I know, this sounds so stupid, but I'm making Pi Hero, which is a remake of guitar hero where you punch in the digits of Pi as they scroll down. This was inspired by my enrichment fair project, because I'm making Keyboard Hero in Java. I need a bunch of help on the format, what it should look like, and in general: how should I make this?
Ok so here are my general thoughts:
~Make it on the graph screen
~I'll have the numbers come in waves of like 3, so it will be like 3,4,5…..6,2,8….4,1,0….
~Have a menu for difficulty
~Make starpower a key (maybe [enter])
~valid notes will be dead on, a few pixels early, or a few pixels late
I'll edit this when i think of more.
Do any of you think i should have like a career mode or no? If so, I'll use other #'s like phi and infinitives.
Sounds good - try finishing the game before adding it, though.
Perhaps have each number stored to a list - then access the list for the numbers.
actually, i was thinking that each song would be a string, so i could use sub(Str1,X,1 where X is the variable used in a for loop.
In either case I suggest packing of some sort (though you might "unpack" it while playing). Even if you managed to fit 2 digits into 1 string character (by using 1 of 100 symbols) that cuts the size down by a factor of 2.
How could i pack it then? Do you mean that stroring like "31415926535…"—>Str1 would be too much memory? After all, I could declare the songs in the begginning.
Well, by creating a 100-character string (any 100 characters will do) and creating a string of the 31st, 41st, 59th, 26th, etc. characters, you'd be saving memory by the bushel. Especially if you plan to have lots of digits.
Also, keep in mind that strings are not random-access: the calculator must read the entire string to access a character near the end.
I actually decided I'm going to use a list for each number ("Song", like Pi or Phi). Also, can you make a conditional inside a conditional?
You mean like:
If x>(y=2)
???
No, I mean like:
If ...... //first condittional
Then
............
........
........
........
If...... //second conditional
........
End
Yes, putting a conditional inside another conditional is allowed; this is usually referred to as nesting. You can also put loops inside conditionals as well.
Guys, does anyone know why this won't work? It's a saving thing that I've tried and it won't work…
The recaller at the beggining of the program:
SetUpEditor ∟SAVE
If dim(∟SAVE≠ 8 //it checks to see if there are 8 digits in LSAVE
{-2,0,1,0,0,1,0,0→ ∟SAVE //If there aren't 8 digits, it adds these ones, or the standard stats
∟SAVE(1→P //from here on down, the list is handing out variables
∟SAVE(2→R
∟SAVE(3→J
∟SAVE(4→Q
∟SAVE(5→C
∟SAVE(6→L
∟SAVE(7→G
∟SAVE(8→I
During the program, the list is changed to {-2,0,1,0,0,1,0,0→ ∟SAVE so that people can't exit and still have their data, while they can exit and the data will be set to starting data. After that, when you execute the Quit and Save command, it does:
{P,R,J,Q,C,L,G,I→∟SAVE //The variables are being put back into the list
Archive ∟SAVE //It is being archived
Would I need to do UnArchive at the beginning? I can't find out what's wrong, because when I save and redo trhe program, the stats are chenged to th standard stats.
One problem I see is that you don't have a closing parentheses before the ≠8. The obvious fix is to place the ≠8 before the dim( command. You can also remove the ∟ symbol when referring to the list with the SetUpEditor command and when storing the list.
:SetUpEditor SAVE
:If 8≠dim(∟SAVE
:{-2,0,1,0,0,1,0,0→SAVE
Hey, does anybody know if the program will get a bit slower after reading the first # on a list, doing stuff, then the second #, doing stuf, 3rd #……etc up until like the 500th number. So like, will it start to slow down dramatically from the first time? thanks for all the help, by the way =D.
No, it doesn't slow down. If slowing down is the result you are getting, then it is most likely a memory leak from using GoTo labels within loops and If-Then commands.
Recalling a list variable is instantaneous, (recalling L₁(1) is the same speed as recalling L₁(999)). I believe that recalling a section of a string is also the same, (sub(Str1,0,1) is same time as sub(Str1,500,1)).
Cheers ~ James Kanjo
Actually, reading characters from a string will slow down, though I don't know if it will slow down significantly. The reason for this is that some characters might be 2 bytes long, so the calculator has to go through the entire string to know the position that the 500th character is at.
By the way, I had thought that I would be extra clever and write a formula to calculate each digit of pi when you went to use it, as I had thought it would use less memory than just storing the Pi to a string.
I came across two failures, the first being the calculator's limitation of how long a number can be when calculating (I think it's something like 16 decimal places), so after a certain decimal place in Pi, the continued digits would end up being zero. I tried to fix this by using a clever method, which extended Pi to 95 digits before becoming zeros, but after the 17th digit, the following digits where not the correct digits in Pi, because of the calculator's previously mentioned limitation, results are not accurate.
The second failure was that my formula was more memory than storing Pi to 100 decimal places in a string, so the whole process was redundant.
I wonder if there is a way to bypass the first error, such as manually calculating Pi using strings. That is, we write a formula for calculating multiplication of numbers in strings. But that would be a mammoth sized program. I could write that sort of program one day….when I am extremely bored and have no life.
Cheers ~ James Kanjo
Haha thanks for the effort man =D. Yah, but i don'thave a clue on how to calculate the digits of pi, so…….yeah….good luck lol. By the way, I'm taking a break from it for a bit and I'm working on an rpg game i never finished.
You'd have to eliminate digits after you used them, or use multiple variables, or lists, or other types of variables, because there's no way to extend the amount of digits in a real variables (14 digits).
Yeah, I used List variable to store each digit of Pi, but that didn't stop the calculator limitation. That's why I suggested using strings, and write a routine to multiply two strings, or add, or whatever I need, but that would use a significant amount of memory, and take a long time to do.
In my experience, it's easier to write such things with lists.
Ya, I'm just using lists 'cuz it's easy to recall the digits as individual numbers
Are you kidding, using a list to store each digit of Pi?
Whilst programmably convenient, it's memory inconvenient. A list with 100 digits of Pi, one digit for each array, is 912 bytes. A string with 100 digits of Pi, is only 111 bytes. A list with 999 digits of Pi, which is the maximum a list can have, is 9003 bytes. Compared with 999 digits in a string, which is 1010 bytes, is a 7993 bytes difference. A string is approximately 88.78151% smaller (89%).
Trust me, the mental labour is worth the effort.
Ok…but the only problem is that strings are read as a character, not numbers. So like sub(Str1,1,1—>A will make the value of A "3" instead of 3. So in other words, look at this program:
sub("3.14",1,1-->A
3-->B
in this case, B isn't = to 3…which makes it difficult…
That can be dealt with using expr()
Yes, but the other issue is the speed with which strings/lists are accessed.
I suggest combining the two: using a string for storing the whole string, but reading characters from it in chunks to a list.
So you mean like….
for(B,1,300,40
for(A,X,Y
Str1(A-->L1
end
delvar L1
B-->X
B+40-->X
? I guess that could work out…
I don't think lists can take string-type elements, you would have to convert it using expr(. Also, you need to use the sub( command to find specific characters of strings.
Abou
t the sub thing…oops that was a careless mistake using Str1(A. I've been dealing with a ton of matrices lately and I had a brain fart. Also, how do you use expr( to make "3"=3? Is it like:
expr(sub(Str1,A,1-->N
? Thanks for your help, btw.
That's exactly how it works.
Yes, that would be clever.
So just before each level, it loads something like 50 digits of Pi to a list from a string, then each array from the list is accessed.
Fast access
AND
Little memory used
Yes, that would be clever.
Cheers ~ James Kanjo
Lists can be both convenient and use less memory than strings, if you're only storing digits. You can compress 14 digits into a single list element - so you can compress 999 digits into 72 elements. That's only 660 bytes - 35% less memory than the string.
Decompression is also fast and easy. Just do a nested loop: the outer loop goes through all the elements in the list, the inner loop goes through all 14 digits in the number using fPart, int, and division by 10.
I've been thinking about this too and really like the idea of combining lists and strings. I have used expr( before to run checks on a number before it is evaluated in my mystery number program. :) I'll be happy to help in any way possible.
Note: If I am replying and it goes far over to the right, the text I am typing goes off the edge of the screen and I can't see it. Just to let ya know ;)
-Ace