Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetWorkingDir %A_ScriptDir%
- FileRead, slopeStr, % A_ScriptDir "\d3.txt"
- 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}]
- slopeLines := StrSplit(slopeStr, "`r`n")
- for yPos, Line in slopeLines {
- for i, angle in slopes {
- if (Mod(yPos - 1, angle.y) = 0) {
- xPos := Mod((yPos - 1) * (angle.x / angle.y), StrLen(Line))
- if SubStr(Line, xPos + 1, 1) = "#"
- slopes[i].c += 1
- }
- }
- }
- result := 1
- for i, j in slopes {
- result *= j.c
- }
- Clipboard := result
Advertisement
Add Comment
Please, Sign In to add comment