Guest User

Untitled

a guest
Dec 3rd, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. FileRead, slopeStr, % A_ScriptDir "\d3.txt"
  4.  
  5. slopes := [{x: 1, y: 1, c: 0}, {x: 3, y: 1, c: 0}, {x: 5, y: 1, c: 0}, {x: 7, y: 1, c: 0}, {x: 1, y: 2, c: 0}]
  6.  
  7. slopeLines := StrSplit(slopeStr, "`r`n")
  8.  
  9. for yPos, Line in slopeLines {
  10.     for i, angle in slopes {
  11.         if (Mod(yPos - 1, angle.y) = 0) {
  12.             xPos := Mod((yPos - 1) * (angle.x / angle.y), StrLen(Line))
  13.             if SubStr(Line, xPos + 1, 1) = "#"
  14.                 slopes[i].c += 1
  15.         }
  16.     }
  17. }
  18.  
  19. result := 1
  20. for i, j in slopes {
  21.     result *= j.c
  22. }
  23.  
  24. Clipboard := result
Advertisement
Add Comment
Please, Sign In to add comment