Old Dos program (Wa-tor) ported to Java runs too quickly

In summary, Dave is looking for a way to slow down the speed of a game he used to play as a child. He has found two methods: using a timer with a callback function, and using Thread.sleep.
  • #1
dkotschessaa
1,060
783
When I was a (very lonely) child, I used to play endlessly with this predator-prey simulation game:
http://www.leinweb.com/snackbar/wator/

(You may have trouble getting this applet to run based on java updates, other security settings and what not).

There is more information about it here:

http://en.wikipedia.org/wiki/Wa-Tor

This program would actually be a great compliment to a presentation I'm thinking of doing. (Haven't found one on the web that works as well).

However, the thing runs EXTREMELY fast. It was originally meant to run on a 1985 DOS machine.

I don't know anything about Java. Is there any easy way to slow it down?

-Dave K
 
Technology news on Phys.org
  • #2
dkotschessaa said:
predator-prey simulation game:
How do I play it?
 
  • #3
Assuming there's a main loop in the game, add an inner loop that just iterates, perhaps with some type of sleep like function.
 
  • #4
Use a timer with a callback function to the game logic.
 
  • #5
Use Thread.sleep:

Code:
try {

    Thread.sleep(1000); // SLEEP for 1 second ie 1000 ms

} catch (InterruptedException e) {

    e.printStackTrace();  

}
 
  • #6
I don't think there's a way to slow down java, unless you wrote the code and have access to it to modify it.

If you can find the DOS version, you can use DOSbox, which I believe has some options to throttle the speed of emulation on more modern PC's, though it can be kind of a pain to configure.

If you do have the source code (if you did the port), the above advice is pretty solid.
 
  • #7
jedishrfu said:
Use Thread.sleep:

Code:
try {

    Thread.sleep(1000); // SLEEP for 1 second ie 1000 ms

} catch (InterruptedException e) {

    e.printStackTrace();  

}

elusiveshame said:
I don't think there's a way to slow down java, unless you wrote the code and have access to it to modify it.

If you can find the DOS version, you can use DOSbox, which I believe has some options to throttle the speed of emulation on more modern PC's, though it can be kind of a pain to configure.

If you do have the source code (if you did the port), the above advice is pretty solid.

Yes, the source code is there on the site i linked. Let me give this a try.
 
  • #8
Computer getting fast are such a pain. At some point all programs written in Turbo Pascal and using crt module stopped to work. From what I remember they were checking how many runs of an internal loop were required per millisecond, that was later used in some kind of sleep() function. Once the integer counter overflowed programs became unpredictable.
 
  • #9
You could always 2 integers (or more) for the checks on cycles and use conditionals to work around that problem. It's not the most glorious method, but it could work without having to rewrite the entire game while ensuring the timing is correct.

Also, I didn't realize the source was available in the link (on my phone, and I'm not a fan of mobile browsing), so I apologize for not checking that out before posting.
 
  • #11
I used to love that game, its a variation of "game of life", predator/pray simulation. Good luck.
 

1. Why is the "Old Dos program (Wa-tor) ported to Java" running too quickly?

The Old Dos program (Wa-tor) was originally designed to run on older computer systems with lower processing speeds. However, Java is a more modern programming language and is optimized for faster execution. As a result, the ported version of the program runs much faster than its original counterpart.

2. Is the faster execution of the Java version affecting the results of the program?

Yes, the faster execution of the Java version can potentially affect the results of the program. Since the program is simulating a natural environment, the speed at which the calculations are performed can impact the behavior and interactions of the simulated creatures.

3. Can the speed of the Java version be adjusted to match the original Dos version?

Yes, the speed of the Java version can be adjusted by modifying the code or parameters of the program. This can help achieve similar results to the original version.

4. Are there any benefits to using the Java version over the original Dos version?

Yes, there are several benefits to using the Java version over the original Dos version. Java is a more modern and widely used programming language, which means it may be easier to find support and resources for the Java version. Additionally, the faster execution of the Java version can save time and resources when running the program.

5. Are there any potential drawbacks to using the Java version?

One potential drawback to using the Java version is that it may require a more powerful computer system to run smoothly. Additionally, the faster execution of the Java version can lead to unintended behavior or results if the program is not properly adjusted for the faster speeds.

Similar threads

  • Other Physics Topics
Replies
34
Views
52K
Back
Top