Overview
In this project, you will require to develop a "back end" of a simple game simulation. No graphical output is required. All output should be stored in a (textual) log file.
In this game, we have: one dragline excavator, two trains, and one power plant. The dragline excavator consumes power cells and produces coal; power plant consumes coal and produces power cells; train consumes power cells and can transport both coal and power cells between excavator and power plant, respectively.
Specification
• Dragline Excavator (1x)
o Consumption: 2 power cells
o Production: 1 coal
o Storage for power cells:
- Max: 30 units
- Initial value: 10 units
o Storage for coal
- Max: 15 units
- Initial value: 5 units
• Power plant (1x)
o Consumption: 1 coal
o Production: 5 power cells
o Storage for power cells:
- Max:50 units
- Initial value: 10 units
o Storage for coal
- Max: 20 units
- Initial value: 10 units
• Train (2x)
o Consumption (from fuel cell tank): 1 fuel cell per one-way trip
o Capacity of fuel tank: 5 power cells
o Carrying capacity: 10 units of either coal or power cells (cannot be mixed!)
Part-1 (Individual Assignment)
Analyze proposed game and answer following questions:
• What should be modeled as threads?
• What should be modeled as variables? Which of them should be global (shared) and which can be local?
• What problems can occur in this game? (List all instances and be specific)
• What constructs can be used to prevent these problems?