This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def part2(data: Seq[String]): Long = { | |
| val grid: Grid[Char] = data.dropRight(1).toArray.map(_.toCharArray).transpose | |
| var grandTotal: Long = 0 | |
| var curTotal: Long = 0 | |
| var op: Op = null | |
| data.last.zipWithIndex.foreach { case (ch, idx) => | |
| if (ch == '+') { | |
| curTotal = grid(idx).mkString.trim.toLong | |
| op = (a, b) => a + b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.mccandless.minotaur | |
| import org.scalatest.{FlatSpec, Matchers} | |
| import scala.collection.mutable | |
| class Day17Spec extends FlatSpec with Matchers { | |
| type Board = mutable.Seq[mutable.Seq[Char]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.mccandless | |
| import org.scalatest.{FlatSpec, FunSpec, Matchers} | |
| import scala.collection.mutable | |
| import Day16Spec.registers | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.mccandless.coolshit.disjointset | |
| import org.scalatest.{FlatSpec, Matchers} | |
| import scala.collection.mutable | |
| import scala.collection.mutable.ArrayBuffer | |
| import scala.io.Source | |
| /** | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package example | |
| import org.scalatest.{FlatSpec, Matchers} | |
| import scala.io.Source | |
| import scala.collection.mutable | |
| /** | |
| * Created by tomas.mccandless on 12/13/18. | |
| */ | |
| class Day13Spec extends FlatSpec with Matchers { |