Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Letters = Static "abcdefghijklmnopqrstuvwxyz"
- get_letter_count :: IO ->> Int
- Empty => Int IO.raw_input ""
- get_letters :: Int ->> String
- count => Letters[:count][::-1]
- tiles_for_letters :: Int ->> Int
- letters => 1 + 2 * (letters-1)
- letter_at_index :: Int, String, Int, Int ->> Int
- tiles, letters, i, target => letters[Int max (abs x - target) (abs y - target)]
- where y = i % tiles, x = i // tiles
- display_line :: Int, [String], Int ->> IO
- width, arr, x => IO.log <- arr[x*width : (x+1)*width]
- do:
- lc = get_letter_count ()
- letters = get_letters lc
- tile_count = tiles_for_letters lc
- target = lc-1
- letter_at_index = letter_at_idx tile_count letters ?
- display = display_line tile_count ? ?
- arr = @ <- letter_at_index [0..tile_count**2]''0
- for x in [0..tile_count]:
- display arr x
Add Comment
Please, Sign In to add comment