skaldjciareio

Advent of Code Day 5 Part 1

Dec 5th, 2020
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. SetBatchLines, -1
  3. SetWorkingDir, %A_ScriptDir%
  4.  
  5. FileRead, read_file, Input.txt
  6.  
  7. seats := StrSplit(read_file, "`r`n")
  8.  
  9. SeatIds := []
  10.  
  11. For each, seat in seats
  12. {
  13.     row := 0
  14.     For i, char in StrSplit(SubStr(seat, 1, 7))
  15.     {
  16.         row += (2**(7-i)) * (char == "F" ? 0 : 1)
  17.     }
  18.     column := 0
  19.     For i, char in StrSplit(SubStr(seat, 8))
  20.     {
  21.         column += (2**(3-i)) * (char == "L" ? 0 : 1)
  22.     }
  23.     SeatIds[row * 8 + column] := 1
  24. }
  25.  
  26. Clipboard := SeatIds.MaxIndex()
  27. MsgBox, % SeatIds.MaxIndex()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×