Rocket Game - from 101 BASIC Computer Games
|
08-16-2015, 04:39 PM
(This post was last modified: 08-19-2015 01:36 AM by smp.)
Post: #1
|
|||
|
|||
Rocket Game - from 101 BASIC Computer Games
I am attempting to convert the old Rocket BASIC game (from 101 BASIC Computer Games by Digital Equipment Corporation) to run on my HP Prime calculator. I'm doing this as one of my exercises in learning to program on the HP Prime, and also to end up with one of the vintage games I love running on my calculator.
Here's the original BASIC code: Code:
If you peruse the original code, you will see the quandary that I'm in. It is peppered with GOTOs and jumps as the result of IF THEN statements. Disentangling this has become somewhat of a mission for me. I have figured out the way I want to do my version of this program. It is a simple falling body in a vacuum problem, so there are two conditions: Are you still above the ground? and Do you have any fuel left for your retro rockets? You must manage your descent using different rates of fuel consumption in order to arrive at the ground with fuel left, and pretty near zero downward velocity. So I have the following code working for a falling body in a vacuum: Code:
This code I have works perfectly like the sample run in the original book for the time that there is 0 as the input for the burn rate, so I figure that I have the falling body in a vacuum code in good shape. Where I have been struggling for the past week, is to understand what the original author is doing to form the opposing vector made by the entry of the burn rate. It looks to me like the original code converts everything to increments of time somehow and computes distance and velocity from that? I'm pretty much stumped at this point. If anyone cares to take a look at the code and offer me any suggestions on how to implement the retro rocket burn rate to slow the descent, I would greatly appreciate any thoughts you may have. Thanks in advance! smp |
|||
08-18-2015, 08:34 AM
(This post was last modified: 08-18-2015 08:41 AM by Martin Hepperle.)
Post: #2
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
In case you would also consider another implementation: Here is one I have written in VBA.
For testing, you can copy it into the VBA environment of a MS-Office application like Word, Excel, Powerpoint and run it there. I think the code is pretty well structured and easy to understand. You could more easily translate it to the Prime than your original BASIC code. Note that the code contains a hardwired "autopilot", which must of course be removed for an interactive game. The numeric values are arbitrary - I did not bother to look up realistic values e.g. for ther "Eagle". Code:
|
|||
08-18-2015, 11:21 AM
Post: #3
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games | |||
08-18-2015, 12:14 PM
Post: #4
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
I was wondering how you were detecting the result of your most current burn rate? As provided the program seems to just show the input screen, until the "Lander" terminates successfully, or not.
However, if a "wait(R);" is used immediately after the INPUT(R); line, the corresponding output becomes viewable. The details for making the program more interactive are more than I want to undertake, but you could make use of graphic commands (described in the user guide) to not only watch the lander progress, but influence the craft as it falls to the landing zone. That would allow you to more easily land the craft at very close to zero velocity, fairly gracefully. Code:
|
|||
08-18-2015, 12:30 PM
Post: #5
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
(08-18-2015 12:14 PM)DrD Wrote: I was wondering how you were detecting the result of your most current burn rate? As provided the program seems to just show the input screen, until the "Lander" terminates successfully, or not. Hi DrD, Yes you are correct in your observation. At present, I am only attempting to get portions of the "simulation" to operate as they did in the original BASIC program. I believe that I've achieved that with the simple falling body in a vacuum code that I presented. I've been trying a variety of other bits of code to see if I can get the decelleration as a function of the burn rate to work anywhere near close to the original, but I have failed in this so far. My intention is to get the mechanics to operate as they did in the original BASIC program, and then move on to learn about getting it to display well on the Prime. Once I get a good replica of the original, I also intend to attempt to learn more about the Prime's display capabilities and embellish the program as you suggest. Thanks very much for your input. I greatly appreciate your assistance. smp |
|||
08-18-2015, 02:39 PM
Post: #6
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
(08-16-2015 04:39 PM)smp Wrote: I am attempting to convert the old Rocket BASIC game (from 101 BASIC Computer Games by Digital Equipment Corporation) to run on my HP Prime calculator. I'm doing this as one of my exercises in learning to program on the HP Prime, and also to end up with one of the vintage games I love running on my calculator. Would the version in the microcomputer edition of 101 BASIC Games help? This was written by Ahl after the original DEC version. The programs were converted from DEC Basic Plus to run in 8K Altair (Microsoft BASIC) Code:
Tom L Cui bono? |
|||
08-18-2015, 04:06 PM
Post: #7
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
(08-18-2015 02:39 PM)toml_12953 Wrote: Would the version in the microcomputer edition of 101 BASIC Games help? This was written by Ahl after the original DEC version. The programs were converted from DEC Basic Plus to run in 8K Altair (Microsoft BASIC) Hi Tom, Thanks very much for this code! It appears that Mr. Ahl changed a number of things from the original, but these directions offer much more insight into how the numbers are supposed to work out, and the calculations seem much more simplified. I'll take a look at this new (to me) code and see what I can make of it. smp |
|||
08-31-2015, 09:43 AM
(This post was last modified: 09-01-2015 06:57 AM by Martin Hepperle.)
Post: #8
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
... and here is a translation of the VBA code to the Prime
... TODO: add a graphical user interface I think, sometimes it is better to start over from scratch instead of trying to convert "old spagheti" to "cuisine nouvelle". Code:
|
|||
08-31-2015, 11:32 AM
Post: #9
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games | |||
12-31-2018, 09:13 AM
Post: #10
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
Hi,
Well, I'd say the program was compressed before being published; that's why it's rather hard to read. In a somewhat less compact version it would look more like this. (Slightly different dialect, for readability.) Code:
(Doesn't immediately tell us what it does, but might make it easier to determine where to look.) BFN, Mysha |
|||
12-31-2018, 07:16 PM
Post: #11
|
|||
|
|||
RE: Rocket Game - from 101 BASIC Computer Games
I don't know if this will help but the Linar Lander game published by HP for the HP-25 has a nice description of the math involved. I played this game so much in the 70's before I wrote a version in BASIC (with "graphics") for my Ohio Scientific C1P microcomputer.
Only 46 lines of code (instructions) in this version. http://www.hpmuseum.org/software/25moonld.htm |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)