aspose file tools*
The moose likes Game Development and the fly likes Baseball Simulator, Classes Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Baseball Simulator, Classes Issue" Watch "Baseball Simulator, Classes Issue" New topic
Author

Baseball Simulator, Classes Issue

David McMonigle
Greenhorn

Joined: Oct 07, 2013
Posts: 8

Hello all! Still new to the forums, so first greetings to all:

I'm still (semi)new to Java, and I've been working on a Baseball Simulator, well, designing first, but I'm having some issues working out the design. The simulator is really just going to take two teams and simulate each at-bat. Here's the design so far:

Simulate each at-bat, iterating innings, outs, runs, various outs/hits/walks.

Average out Pitcher OBP and Batter OBP to calculate probability of individual batter getting on basse
1.) Calculate Batter Hit percentage/ ExtraBase Percentage/ DoubleTriple Percentage/ Triple Percentage. etc
2.) Math.random() to determine these probabilities.

Add outs, move runners, add runs, iterate innings.

That's really the main idea, although the issue is this: I have a Super class in mind (BallPlayer) that will have two child classes (Batter and Pitcher). I'm wondering how I can go about making them go have an at-bat. Would an interface work to my advantage here?

Any advise would be much appreciated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Baseball Simulator, Classes Issue
 
Similar Threads
So who is the greatest?
Science explains Superman
what is the difference between SCJP,SCJA,SCJD
How do other sports resolve draws? (AKA: AFL madness)
Abstract Classes extending concrete classes