jsbasic/samples
Joshua Bell 6278f871fb Several sample fixes/improvements by Alan Ratliff
**In "Simple Pong" I eliminated the problem of the bouncing ball erasing the bottom wall of the field, created a means of scoring points (when the ball gets past a paddle and hits the "back wall", the other player scores a point -- one point each time the ball gets past the paddle, so that multiple impacts that typically occur don't count a point each), and allowed the possibility of equiangular bouncing off the paddles, instead of always just bouncing straight back along the same trajectory.

Also, this game isn't really suited for "paddle"-type control on this platform, as there is typically just one mouse for that purpose, not practical for two players. However, with key-control, the comments cited a problem of needing to be able to handle multiple keystrokes. As it was, when one player pressed a directional key, their paddle would start moving and not stop until it hit its upper/lower limit. It would stop, though, if a non-operational key were pressed, or one of the other player's keys. This latter meant that one player hitting a key to move their paddle would stop the other player's paddle from moving, which was where the real problem occurred. Underlying this was the fact all movement was controlled by the single last key pressed. I changed it by introducing variables to control the movement of each paddle which would be set by the appropriate keystrokes. I also added a specific key for each player to stop their paddle's motion, as well as duplicate directional keys so that each player's key group would be suitable for either the left or right hand: with either hand they could press "down" with the index finger, "stop" with the middle finger, and "up" with the fourth finger.

***With "Hangman", I did the usual random-seeding, avoided the initial-keystroke-termination problem, and simplified the word-choosing algorithm, and set it to go through all words in a difficulty-group, then continue by choosing among the 9 words in that group least-recently used. I also incorporated level-change options in the new-game menu, and I greatly reduced the code for the circle-drawing routine (while still utilizing principles of geometry), and re-organized the parts-drawing routines so the "smiley face" routine could be simplified.

***Next is the "Door Detector" game program. Its problems were subtle ones, principally that it would occasionally crash with an "Illegal quantity error in line 320". This concerned the value of "G" that was assigned as COLOR. This crash was quirky, as the program maintained the value of G between 0 and 15 in some places, but not others, while supposedly the value given to COLOR is not "Illegal" unless it's outside the byte-range 0-255; within that range the value merely has its lower nybble isolated to serve as the COLOR value. I put in a tweak to print the value of G to be used in line 320, and upon a crash it was shown as 50. I'm not sure why it occurred this way, but I figured that a way to be safe would be to just *always* ensure that G is kept in the range 0 to 15.

The program also had the "standard" problem that it didn't seed the random-number generator, so it always played an identical "game sequence" every time, instead of different permutaions as you'd normally expect with "random numbers".

Another "subtle" shortcoming I noticed concerned the fact that in successive "rooms" within a game, the "Death Zone" is an incrementally "thick" border region around the room, and in any given room the "exit" could be randomly placed right next to the "Death Zone's" edge, and as the player would start the next room where the previous room's exit was, a next-to-Death-Zone exit would mean the player would start the next room IN the Death Zone (its innermost layer). As it happened, in the one game-sequence that occurred, the final room's exit in the first game was along the Death Zone's edge, but as it was the FINAL room anyway, the next-room starting location was not an issue. I figured, though, that with the game properly randomized, the issue COULD come up, so I now use line 50 (commented in 40) to bump the player out of the Death Zone if they're starting a room within the Zone.

***With "Columns" there was the usual lack of random seeding, and again a rather drab color scheme for the lower number of colors. I also reduced the maximum number of colors by one, so that it would never use both of the indistinguishable grays. Also a comment on line 2840 mentioned a "Future animated splash screen", so I created one.

***The primary problem with "Chase" was lack of random seeding, so it always played the same sequence of games, which would wear out quickly. There were also a few duplicate line numbers I eliminated. The game presentation could also be improved by simply VTABbing up to display each new board layout over the old one, rather than scrolling up for new diagrams. Also, I documented in the instructions how a player should expect to encounter impossible situations frequently, and just move on when that happens; and I generally streamlined the code considerably, including cleaning up messy text displays.

***With "Gaussian distribution 2D", trying an example resulted in an "Illegal quantity in line 160". This was caused by the hires X coordinate just exceeding the maximum 279, apparently due to imprecise calculations. Reducing the designated maximum (assigned to 'w') in line 30 to a value of 278 seems to clear this up. I also reduced the maximum Y a bit so the diagram would not butt against the text on screen-line 21. In addition, there were a few (i.e. redundant) explicit expressions of the value of PI, all then multiplied by 2 to obtain 2PI; I replaced these with one derivation of PI/4 via ATN(1), multiplied by 8 to obtain 2PI, and stored it in variable 'p2' (for "PI * 2").

***With "Original Series Enterprise" I created a much more accurate depiction of said entity. To be honest, it really isn't Gil Keidar's anymore, it's mine...

***Finally, with "Prime Factors", the old version, in a number of cases, did not produce the correct results. I have fixed that problem. I also replaced its series of like multiplications (e.g. 2x2x2x2x2x2) with a base^exponent exprression (2^6).
2024-02-19 11:03:15 -08:00
..
TRADER C.txt Snapshot 2012-02-08 22:13:44 -05:00
index.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.3dhat.txt Add samples c/o Golden Child 2020-01-14 18:20:14 -08:00
sample.3drectangle.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.10print.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.adventure.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.aritm.txt Add Aritm game (#42) 2022-01-29 10:35:03 -08:00
sample.artillery.txt Add Artillery sample 2022-10-23 15:23:41 -07:00
sample.basic.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.bite.txt Add Bite sample 2022-10-23 15:25:37 -07:00
sample.bitmaps.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.blackhole.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.bodymass.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.boys_surface.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.building.txt Add Building sample 2022-10-23 15:12:48 -07:00
sample.calculatedimage.txt Add samples by Gregg Buntin 2016-12-03 11:21:04 -08:00
sample.charset.txt Style separation 2013-08-17 15:15:54 -07:00
sample.chase.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.codabar.txt Add Codabar Generator sample 2022-10-23 15:04:43 -07:00
sample.coloredserpinski.txt fix truncated sample 2020-02-10 08:06:56 -08:00
sample.colorrings.txt Add a few more samples 2020-02-09 21:08:51 -08:00
sample.columns.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.connections.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.dbconverge.txt Add samples c/o Golden Child 2020-01-14 18:20:14 -08:00
sample.dbpendulum.txt Add samples c/o Golden Child 2020-01-14 18:20:14 -08:00
sample.dbvectorship.txt Add samples c/o Golden Child 2020-01-14 18:20:14 -08:00
sample.dbvectortext.txt Add samples c/o Golden Child 2020-01-14 18:20:14 -08:00
sample.default.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.dicegame.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.doordetector.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.dragonsmaze.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.dye.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.enterprise.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.enterprise2.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.factors.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.february.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.fsim.txt New samples, updated docs 2013-08-18 21:26:39 -07:00
sample.functiongraphing.txt More samples by Golden Child 2020-01-29 21:31:02 -08:00
sample.gaussian.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.hacker.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.hangman.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00
sample.hellosine.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.hgrblends.txt New samples, updated docs 2013-08-18 21:26:39 -07:00
sample.hireswalk.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.jobs.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.jot.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.keyboard.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.logo.txt Added new sample 2013-05-06 00:12:26 -04:00
sample.loresdrawing.txt Add samples by Gregg Buntin 2016-12-03 11:21:04 -08:00
sample.loreswalk.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.mandelbrot.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.mandelbrot2.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.miniindy.txt Sample fix 2016-12-03 15:28:45 -08:00
sample.moire.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.ninjaturtle.txt add ninja turtle example (#26) 2019-01-02 19:12:59 -08:00
sample.nuclear.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.onelinetrain.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.pacman.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.paint.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.piglatin.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.platformer.txt Samples: Update platformer, c/o Brendan Ghareeb 2024-01-13 10:18:34 -08:00
sample.pretzel.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.primecheck.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.primes.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.protonelectron.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.puzzler.txt Various game fixes and enhancements by Alan Ratliff 2020-06-20 15:49:59 -07:00
sample.quine.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.radar.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.raindrops.txt Various game fixes and enhancements by Alan Ratliff 2020-06-20 15:49:59 -07:00
sample.randommaze.txt Added Random Maze sample by Alan Rat 2024-02-10 18:36:39 -08:00
sample.readsector.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.rodscolorpattern.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.scribble.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.sectorgen.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.sierpinski.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.sierpinski2.txt Add Sierpinski triangle by Helen Edgar 2024-02-19 10:26:21 -08:00
sample.snowflakes.txt Added 'Snowflakes' sample 2017-08-27 18:47:08 -07:00
sample.spaceattack.txt Various game fixes and enhancements by Alan Ratliff 2020-06-20 15:49:59 -07:00
sample.squiggle.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.stellar7.txt More samples by Golden Child 2020-01-29 21:31:02 -08:00
sample.steve.txt Update some URLs 2020-06-20 15:36:17 -07:00
sample.stringart.txt Snapshot 2012-02-08 22:13:44 -05:00
sample.stringfns.txt Add STRING$ and SPACE$ Demo (Alan Ratliff) 2024-02-19 10:35:04 -08:00
sample.tetris.txt Various game fixes and enhancements by Alan Ratliff 2020-06-20 15:49:59 -07:00
sample.thunderclock.txt Thunderclock: Tweak DOS/BASIC handling of colons 2024-02-11 15:16:39 -08:00
sample.unfinishedmaze.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.unittests.txt Further fixes for LEFT$/MID$/RIGHT$ and tests 2022-12-05 18:46:44 -08:00
sample.vdt.txt Add a bunch of samples 2020-02-09 21:02:04 -08:00
sample.xmastree.txt Updated sample 2016-12-06 23:35:54 -08:00
sample.zhorelay.txt Snapshot 2012-02-08 22:13:44 -05:00
simple.pong.txt Several sample fixes/improvements by Alan Ratliff 2024-02-19 11:03:15 -08:00