• Post Reply Bookmark Topic Watch Topic
  • New Topic

Baseball Simulator, Classes Issue  RSS feed

Posts: 24
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!