Skip to content

List of Crystal Kata to Update

Voile edited this page May 6, 2021 · 29 revisions

NOTE: Simply remove the kata from the list after updating.

Crystal 1.0 was added, but the following are not compatible. Please help updating them.


Common fixes:

  • Replace / with // (floored division)
  • Refactor the fixed tests if it is assigning the same variable inside describe but outside it, e.g:
def square(n) n*n end

describe "Test" do
  n = 1
  it "{n}" do
    square(n).should eq 1
  end
  n = 5
  it "{n}" do
    square(n).should eq 25
  end
end

Would fail because it blocks are run asynchronously(?), hence when all it blocks are run they all receive the last n. Either put n inside it block or refactor the test into a list iteration:

def square(n) n*n end

describe "Test" do
  test_cases = [[1,1], [5,25]]
  test_cases.each do |(n, ex)|
    it "#{n}" do
      square(n).should eq ex
    end
  end
end

Many of the translations by one user have nested it, and apparently have been displaying a corrupted output for many years (these does have very low completions considering the age). Nested it is a compile error in newer Crystal. These are also poorly structured, lacks proper indents, and the reference solution is "one-liner". So, please consider improving them as well. If the reference solution is difficult to understand, and prevents upgrade, replace with a better one.


  1. Alex & snooker: points earned.
  2. Arrays and hex color codes
  3. Balanced Number (Special Numbers Series #1 )
  4. Basics 08: Find next higher number with same Bits (1's)
  5. Binary operations #1
  6. Bonuses
  7. Boolean logic from scratch
  8. Casino chips
  9. Christmas baubles on the tree
  10. Color Choice
  11. Computer problem series #1: Fill the Hard Disk Drive
  12. Consecutive k-Primes
  13. Convert number to reversed array of digits
  14. Correct the time-string
  15. Creating a string for an array of objects from a set of words
  16. Custom Christmas Tree
  17. D&D Character generator #1: attribute modifiers and spells
  18. D&D Character generator #2: psion power points
  19. Dan's great power generator
  20. Diamonds and Toads
  21. Diophantine Equation
  22. Disease Spread
  23. Easy Diagonal
  24. Elections: Weighted Average
  25. Eliminate the intruders! Bit manipulation
  26. Estimating Amounts of Subsets
  27. Factorial decomposition
  28. Fibonacci, Tribonacci and friends
  29. Forth
  30. Frank's Sticky Calculator
  31. Generic numeric template formatter
  32. Get the Middle Character
  33. Getting along with Integer Partitions
  34. Hello World - Without Strings
  35. Help your fellow warrior!
  36. How many e-mails we sent today?
  37. How many numbers III?
  38. Integers: Recreation One
  39. Is my friend cheating?
  40. k-Primes
  41. Longest palindrome
  42. Master your primes: sieve with memoization
  43. Median fun fun
  44. Mutate My Strings
  45. New £5 notes collectors!
  46. Ninety Nine Thousand Nine Hundred Ninety Nine
  47. No ifs no buts
  48. Number Format
  49. Order of weight
  50. Pair of gloves
  51. Parametric to Rectangular Equation
  52. Parsing JSON leaves
  53. Password generator
  54. Password System
  55. PRNG: Linear Congruential Generator
  56. Progressive Spiral Number Branch
  57. Quadruple M
  58. Queue time counter [hard core version]
  59. Reducing by rules to get the result
  60. Reducing by steps
  61. Resistor Color Codes
  62. Resistor Color Codes, Part 2
  63. Return 1, 2, 3 randomly
  64. SCHEDULE YOUR DA(RRA)Y
  65. Scramblies
  66. SHA-256 Cracker
  67. Some Egyptian fractions
  68. Statistics for an Athletic Association
  69. String subpattern recognition III
  70. Sum of a Sequence [Hard-Core Version]: overflows
  71. Sum of differences between products and LCMs: overflows
  72. Sum of Triangular Numbers: overflows
  73. Target Date
  74. To square(root) or not to square(root)
  75. Tortoise racing
  76. Tram Capacity
  77. Tribonacci Sequence
Clone this wiki locally