oldoc63 / learningFS

Web development back and front
0 stars 0 forks source link

A video game consist of two players floating using 100 helium balloons. #1041

Open oldoc63 opened 2 years ago

oldoc63 commented 2 years ago

The players shoot pellets at each other's balloons and after 10 minutes the player with the most balloons left wins.

oldoc63 commented 2 years ago

Write a game function balloonAttack that takes two Player instances, calculates the balloons left for each player after 10 minutes (using the hitsPerMinute property) and returns the name of the winner. If the result is a tie, return the string 'Tie'.

oldoc63 commented 2 years ago

You can test your balloonAttack function by creating two instances of the Player class to use as arguments for your function like below:

const p1 = new Player('p1', 5); const p2 = new Player('p2', 2);

balloonAttack(p1, p2);

Feel free to use the status() method to output each player’s balloon count at any given time.