开发者

Simulation Problem Java

I'm new to simulation and i just wanted to find out the best approach to solve a certain problem i have come up with.

I have a "world" in which there are different Locations (different cities). In each city, there are a certain random amount of crews that operate. Each crew has a name, reputation level, a certain amount of money, and amount of businesses that it controls. Each of these businesses is controlled in a different way, for example a bank might require a lot of security which would require money to be spent in this department, while a hotel will require more money to be spent in renovations/structural upgrades for the business to be successful. Each business will bring in a certain amount of money each week to the crew. Crews will typically attempt to takeover another crew's business within the same city if the business is vulnerable. A business is rendered vulnerable if it is lacking in its important departments such as security, etc.. (which vary from business to business).

I need to somehow implement this model of crews acquiring businesses, maintaining/defending them, while attacking开发者_Python百科 other crews when opportunity arises, but i'm completely lost as to where to begin. I could create a whole lot of random what if scenarios, but i know there has to be a better way. Any help is appreciated, thanks.


Start thinking about your high level entities and more importantly, the relationships between those entities.

Here are some of the nouns (entities that exist in your simulation):

  • World
  • Cities
  • Crews
  • Businesses
  • Money

Here are some of the verbs (relationships that exist between your nouns):

  • Attack/Defend businesses
  • Aquiring a business
  • Business requirements detection/checking (security, capital, etc...)
  • Vunerability checking
  • Earning money
  • Tracking money
  • City boundary checking (crews attacks crews in the same city)
  • Opportunity calculations (for crews to attack)

I'm sure there are probably more. The point is that you need to assess what mission critical things need to exist for your simulation to be useful.

The calculations for vulnerability and opportunity will have to be somewhat arbitrary based upon a somewhat reasonably safe assumption that you are not a mathematician. Determine what you consider to be more important in the decision process that a crew goes through.

The nouns are really pretty straight forward. You just need to give careful consideration to your data structures for housing the different entities. Consider how you intend to use the objects and utilize data structures that will maximize performance as well as your ability to be flexible in case changes arise later down the development process.

The relationship classes usually present struggles because it can be difficult to accurately describe what a process is doing. Try to follow the SRP (Single Responsiblity Principle - an object should have a single responsibility, and that responsibility should be entirely encapsulated by the class). That said, don't be a zealot about it either. Sometimes it makes more since when two closely related processes should be lumped together.

GL

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜