Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Deep Toaster

Pages: 1 ... 16 17 [18]
TI Z80 / Calcalca
« on: May 28, 2010, 06:36:25 pm »
I'm pretty sure this hasn't really been done before, at least in TI-BASIC, but if something similar exists, please notify me.

Last year, I was absolutely amazed by the simplicity and ingenuity of Google Calculator, especially where you can type in any expression using any units (and an optional unit to convert to), and I decided that that was something someone needed to code for TI calculators. Thus I went on a coding rage, and actually got much of it done within a month, to the point where you could type in something like 7 M * IN INTO CM CM and it would display 1778. Unfortunately, I couldn't figure out division, parentheses, or exponents, so I set it aside and continued with other projects. One day, I really needed to clear some ARC space, so I deleted the group where I had saved it (I called it CALCALCA). I finally started regretting this decision, and will start coding it again, but I really need help with the issues I mentioned above.

This is what I've decided for the program so far:
1. It will use a blank input (Input "",Str1) to input a continuous expression.
2. The resultant string will searched through first for illegal characters.
3. The string is checked a second time, this time for the characters " INTO " (which specifies that the following units say what unit the user wants)
4. First, "(" is added to the beginning, and ")" to the end, just for padding (i.e., "("+Str1+")"→Str1)
5. The string is then evaluated, one character at a time.
    a. Whenever it hits a space, it tests to see whether * follows it.
        i. If there is one, the space is deleted by using sub('s for the two sides of the string.
        ii. If there is not, the space is replaced with )(, which assumes the space meant implied multiplication.

    b. Whenever it hits a letter, a subloop gets the entire combination of letters, which is saved to another string for checking.
        i. The second string is checked against a database of all the units to be supported (see note below).
        ii. If there is a match, that entire section of the main string is replaced with the numerical value of the unit, surrounded by "(" and ")", and the unit's base units are added to a list (see second note below). matrix.
    c. Whenever it hits a number, ".", "*", or "E", it it added directly.
    d. Whenever it hits a "(", the matrix is widened by one, and base units added from then on are added to the new column.
    e. Whenever it hits a ")", it stored the rightmost column into L1 and checks the following character.
        i. If it is a "-1", L1 is inverted.
        ii. If it is a "2", L1 is doubled.
        iii. If it is a "^", another subloop is used to get the entire number following it, and L1 is multiplied accordingly.
        iv. L1 is integrated into the next-rightmost column of the matrix.

6. When this is all done, the program will evaluate the string (with an exp() and (theoretically) appends the final unit.

The database consists of a huge (literally, huge, and might even be larger than the program itself) string containing each supported unit in the format:
Code: [Select]
"   2            Pa           -1    01    00    -2             1.00000000           ..."
    ^            ^            |                  |                  ^                ^
    |            |            +------------------+                  |                |
    |            |                     |                            |                |
Length of     Unit name.    These four numbers are the       How many of the      Continue
unit name.                  base units for the unit, in      unit fit into        onto next
                            the order {length, mass,         the base unit.       unit.
                            current, time}. For example,     Since pascals are
                                Pa=N/(m^2)                   the base for
                                =(kg*m/(s^2))/(m^2)          pressure, this
                                =kg/(s^2)/m                  would be a one
                            so is mass (the positive         (the zeroes are
                            one) divided by time squared     because it needs
                            (the negative two) divided by    to have exactly
                            length (the negative one).       ten characters).

Anyone willing to help me with this program? I currently have several programs in development simulataneously, and I can't finish this myself.
By the way, if anyone can't read the above code, I attached it as a .txt:

TI-BASIC / Sidescrolling
« on: May 28, 2010, 03:37:34 pm »
I'm starting on a platform game called Absolute Insanity II, and I don't know if I should include sidescrolling. It's going to use stat plots for the main graphics portion. I've never used them before, but they seem pretty fast compared to sprites, so I was thinking of including sidescrolling if it ends up running fast enough. I've tried to make a simple sidescrolling engine, but it hasn't worked so far. Is it even possible to have sidescrolling on the graph screen, or is this another one of my overambitious failures? If anyone knows of a program (in pure BASIC) that has sidescrolling on the graph screen, please tell me. I really need examples right now.

Pages: 1 ... 16 17 [18]