Skip to content

Tamim200042130/RacingGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RacingGame

It is a simple racing game.

Problem Statement:

Description:

Let’s say we want to implement a single-player racing game. Since it is a single player we need to make a game where the player races against himself using a time tracker. Now we can choose a car, we can tune that chosen car, choose a track, and at last race. We can also use the pit stop option to apply the Nitrous oxide system or NOS to the car. Assumptions:

So we are not actually making a game, we are going to build a skeleton of the game using print functions like we do in the design pattern lab. The assumptions are,

  1. We don’t actually track the time, we just use a random number generator to generate a random number and convert it to HH::MM::SS format.

  2. We assume children of a Car class only show the car information and the parent class The car has start, stop, and accelerate methods which contain only print functions and nothing else. And this goes for every method of every parent or child class. This means you don’t need to make an actual car or track. Even the race can be a prototype with lots of print functions.

  3. You are most welcome to make actual cars, and tracks with complex functions but you need to complete all the objectives mentioned in the next section. Objectives You need to fulfill the objectives to get a satisfactory mark.

  4. You need to incorporate a total of 5 different patterns inside the above scenario. The patterns are strategy, template, singleton, factory, and decorator.

  5. Car class has engine and turbocharger behavior and we can update this behavior in the run time.

  6. Rii class (main class) has an abstract factory of cars and a factory of tracks and a player can choose a car and track using these factories.

  7. In the whole run time of this game, a player can create only one instance of the Player class.

  8. While racing we can use pit stops, where we add extra functionality of NOS to our car object at the run time.

  9. In the race class we have a race method that has generalized steps of action we need to do to complete a race.

  10. You can implement more types than mentioned in the directions but not less.

  11. Use the New operator as low as possible in the main class Rii. (Hint: use static methods) Directions

  12. You can have these four cars ToyotaGR86, SubaruBRZ, PorscheBoxster, and Ferrari812. Toyota and Subaru reside under the Coupe car category whereas Porsche and Ferrari fall under Roadster.

  13. You can have these three tracks Blue Moon Bay Speedway (USA), BB Raceway (Japan), Circuit de Spa-Francorchamps (Germany).

  14. You can have these three engines : v6, v8, v12 and turbochargers : Alpine, Cummins, Honeywell.

  15. You can have these two NOSs called Resonac and Sema.

  16. You can have two types of racing: sprint and circuit. In circuit racing finishing line means the start of the track (since the track is circular) whereas in sprint racing finishing line means the end of the track. And both have a start line at the start of the track.

  17. You need to take input from a player such as what type of car he is choosing, what type of track and what sort of racing he prefers. The choices should not be hard coded.

  18. In the Race class we have the race method which is final and can have steps like, a) Car.carInfo(); b) Track.trackInfo(); c) startCar(Car); d) startLine(Track); e) accelerateCar(Car); f) NOS = pitStop(Car); //NOS is an extended class of Car g) applyNos(NOS); h) finishLine(Track); i) stopCar(NOS); j) lapTime(); // print random time

Helper Functions:

  1. You can import SimpleDateFormat and Random to implement lapTime().
  2. You can import Scanner to take input from players.

To see the explanation:

https://tamim200042130.notion.site/DP-Project-5d4478567ae3492091dddbd9def164f8?pvs=4

About

It is a simple racing game.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages