Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. List := StrSplit(FileOpen("day3_input.txt","R").Read(),"`r`n")
  2.  
  3. result := 1
  4. for _, v in [[1,1],[3,1],[5,1],[7,1],[1,2]]
  5.   result *= GetNumberOfHitTrees(v[1],v[2],List)
  6.  
  7. MsgBox % result
  8.  
  9. GetNumberOfHitTrees(right,down,list) {
  10.   index := count := 0
  11.   for k, v in list {
  12.     if !Mod(k-1,down) {
  13.       index++
  14.       count += (SubStr(v,Mod(1+(index-1)*right,StrLen(v)),1)="#")
  15.     }
  16.   }
  17.   return % count
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement