BBC BASIC for Windows
« Target (game) »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Target (game)  (Read 129 times)
David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Target (game)
« Thread started on: Aug 22nd, 2012, 05:54am »

Download (EXE + source):
http://www.bb4wgames.com/progs/zip/target.zip

--

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.

http://www.bb4wgames.com/temp/target12mc.zip

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.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Target (game)
« Reply #1 on: Aug 22nd, 2012, 3:28pm »

on Aug 22nd, 2012, 05:54am, David Williams wrote:
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.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: Target (game)
« Reply #2 on: Aug 22nd, 2012, 9:21pm »

on Aug 22nd, 2012, 3:28pm, Richard Russell wrote:
If the interpreted code is taking "several minutes" I would expect an optimised assembler version to take perhaps a second or so.


I would hope so. It takes anywhere from a fraction of a second, up to a few minutes as things currently stand.

***

Version 1.3 is up (Zip folder includes source):

http://www.bb4wgames.com/progs/zip/target13.zip

- 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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls