7 kyu

Pirate Code

478 of 803Parix

Description:

Take a look at this pirate game.

Give Amaro an array to confirm his logic for the next time, when the number of pirates changes.

Keep in mind that each time the pirates find a treasure, the amount of gold equals to the number of pirates * 20.

Example:

If number of pirates is 2, including Amaro, then array = [40, 0], So he can keep all of the gold to himself.

If number of pirates is 3, including Amaro, then array = [59, 0, 1], and 59 gold is his for the taking.

If number of pirates is 4, including Amaro, then array = [79, 0, 1, 0], and 79 gold is his to take.

If number of pirates is 5, including Amaro, then array = [98, 0, 1, 0, 1], and 98 gold is his for the taking.

...

Puzzles
Games
Fundamentals
Arrays

More By Author:

Check out these other kata created by Parix

Stats:

CreatedOct 18, 2017
PublishedOct 18, 2017
Warriors Trained1483
Total Skips11
Total Code Submissions2032
Total Times Completed803
JavaScript Completions478
Ruby Completions37
Python Completions320
Total Stars19
% of votes with a positive feedback rating89% of 197
Total "Very Satisfied" Votes163
Total "Somewhat Satisfied" Votes25
Total "Not Satisfied" Votes9
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Parix Avatar
  • ZED.CWT Avatar
  • ejini战神 Avatar
Ad