BBC BASIC for Windows
Programming >> Graphics and Games >> Target (game) http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1345614890 Target (game)
Post by David Williams on Aug 22nd, 2012, 05:54am
I've also uploaded an experimental version which implements (currently in BASIC, so it's slow) a crude Monte Carlo-esque simulation which attempts to find a shooter position and initial projectile velocity such that the target will be hit.
During the game, press 'M' to start the Monte Carlo simulation, and be prepared to wait several minutes (an assembly language implementation would return practically instant results). When a 'solution' is found, you'll be asked to press Space Bar, and after that, the shooter is automatically moved to the appropriate firing position, and the initial projectile velocity is set. Press Space Bar to fire!
If you'd like a visual representation of what the Monte Carlo simulation is doing, press 'D' during the simulation (the program's not very responsive to keypresses during this process so keep the 'D' key pressed for as long as it takes).
Rgs, David.
Re: Target (game)
Post by admin on Aug 22nd, 2012, 3:28pm
be prepared to wait several minutes (an assembly language implementation would return practically instant results).
If the interpreted code is taking "several minutes" I would expect an optimised assembler version to take perhaps a second or so. Obviously it's very variable depending on the actual operations being performed but typically BB4W might run a few hundred times more slowly than machine code. That's fast for a traditional interpreter!
Richard.
Re: Target (game)
Post by David Williams on Aug 22nd, 2012, 9:21pm
- Your 'ship' now resides in centre of screen / window - You rotate the ship with the left and right arrow keys
David.
PS. You can cheat by pressing 'M' during the game and have the program find a correct orientation and projectile speed for you. Press 'D' (firmly) whilst this is happening to watch the process in action. Press Escape (firmly!) to cancel the search.