Wankan

Display Letter Hot Target in CF

Sep 10th, 2020 (edited)
1,029
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Letters = Static "abcdefghijklmnopqrstuvwxyz"
  2.  
  3. get_letter_count :: IO ->> Int
  4. Empty => Int IO.raw_input ""
  5.  
  6. get_letters :: Int ->> String
  7. count => Letters[:count][::-1]
  8.  
  9. tiles_for_letters :: Int ->> Int
  10. letters => 1 + 2 * (letters-1)
  11.  
  12. letter_at_index :: Int, String, Int, Int ->> Int
  13. tiles, letters, i, target => letters[Int max (abs x - target) (abs y - target)]
  14.     where y = i % tiles, x = i // tiles
  15.  
  16. display_line :: Int, [String], Int ->> IO
  17. width, arr, x => IO.log <- arr[x*width : (x+1)*width]
  18.  
  19. do:
  20.     lc = get_letter_count ()
  21.     letters = get_letters lc
  22.     tile_count = tiles_for_letters lc
  23.     target = lc-1
  24.  
  25.     letter_at_index = letter_at_idx tile_count letters ?
  26.     display = display_line tile_count ? ?
  27.  
  28.     arr = @ <- letter_at_index [0..tile_count**2]''0
  29.     for x in [0..tile_count]:
  30.         display arr x
RAW Paste Data