Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
J 0.60 KB | None | 0 0
  1. wb =. 'white',:'black'
  2.  
  3. dist =. [: %: +/@:*:@+.@(-&50j50)
  4. clamp =. ((o. 2)&+)^:(<&0)
  5. angle =. [: clamp (o. 0.5) - 12 o. (-&50j50)
  6.  
  7. solve =. inradius`('white'"_)@.(dist@] > 50"_)
  8. inradius =. otherwise`(wb {~ 0 < [)@.((50 = [ *. 50 <: ])/@+.@])
  9. otherwise =. wb {~ (angle % o.@2:)@] <: %&100@[
  10.  
  11. join =. ([,LF,])/
  12.  
  13. NB. Drop head because we don't need the number of cases
  14. cases =. >@}.@(-.&a:)@(e.&(CR,LF) <@".;._2 ])
  15.  
  16. format =. [: , ,&': '@('Case #'&,)@":"0@>:@i.@# ,. (,&LF)"1
  17.  
  18. in =. 1!:1 <'progress_pie.txt'
  19. out =. format ({. solve j./@}.)"1 cases in
  20. out 1!:2 <'progress_pie_out.txt'
  21.  
  22. exit''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement