For want of a symbol
Description:
Story
Pete wrote a code to print 20 stars. While he was away, John replaced one character and got this:
{ var i, N=20; for (i = 0 ; i < N ; i--) { PrintStar(); } }
What was Pete initial code? You get three guesses.
Formal problemFor()
should return an array of three strings. They should differ from code example above in one and only one character, they should all be different and each of them should be the correct code that outputs exactly 20 stars.
Notes and hints
-- Character should be replaced, not inserted or deleted (i.e. all strings should be of the same length as initial one).
-- Declaring elsewhere new functions which differ from one called to print star in current code by only one character (e.g. Printstar()
instead of PrintStar()
) is not a correct solution.
Credits
Kata based on "Checking basics of for
loop" puzzle from braingames.ru: http://www.braingames.ru/?path=comments&puzzle=169 (russian, not translated).
Similar Kata:
Stats:
Created | May 13, 2015 |
Published | May 14, 2015 |
Warriors Trained | 419 |
Total Skips | 26 |
Total Code Submissions | 829 |
Total Times Completed | 116 |
JavaScript Completions | 116 |
Total Stars | 12 |
% of votes with a positive feedback rating | 96% of 59 |
Total "Very Satisfied" Votes | 56 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 17 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |