Java modeling problem

I am new to simulation and I just wanted to find the best approach to solve a specific problem that I am facing.

I have a "world" in which there are different locations (different cities). Each city has a certain number of crew members who work. Each team has a name, level of reputation, a certain amount of money and the number of enterprises it manages. Each of these enterprises is controlled differently, for example, the bank may require most of the security that will require the money that will be spent in this department, while the hotel will require more money that will be spent on repair / structural updates for the business to be successful. Each company will bring a certain amount of money to the crew every week. Crews usually try to capture another business in the same city if the business is vulnerable. A business is vulnerable if it lacks its important departments, such as security, etc. (Which vary from business to business).

I need to somehow implement this model of crews acquiring enterprises, supporting / protecting them, while attacking other crews when the opportunity arises, but I completely lost where to start. I could create a lot of random events if there were scripts, but I know that there must be a better way. Any help is appreciated, thanks.

+4
source share
1 answer

Start thinking about your high-level objects and, more importantly, the relationships between these objects.

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

  • World
  • Cities
  • Crews
  • Companies
  • Money

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

  • Assault / Business Defense
  • Active business
  • Definition / verification of business requirements (security, capital, etc.)
  • Health Check
  • Receiving the money
  • Money tracking
  • Checking the boundaries of the city (crews attack crews in the same city).
  • Calculation of capabilities (for attack by crews)

I am sure, probably more. The point is that you need to evaluate what critical things must exist in order for your simulation to be useful.

The calculations for vulnerabilities and opportunities should be somewhat arbitrary, based on the somewhat reasonably safe assumption that you are not a mathematician. Determine what you consider more important in the decision-making process that the crew conducts.

Nouns are really quite straightforward. You just need to carefully consider your data structures to place various objects. Think about how you intend to use objects and use data structures that maximize performance, as well as your ability to be flexible in case changes occur later in the development process.

There is usually a struggle in relationship classes because it is difficult to accurately describe what the process does. Try to follow the SRP (the principle of a single responsibility - the object must have one responsibility, and this responsibility must be fully encapsulated by the class). However, don't be a fan of it. Sometimes this happens when two closely related processes have to be combined together.

GL

+5
source

Source: https://habr.com/ru/post/1369598/


All Articles