; Requires the input for Advent of Code(http://adventofcode.com/) Day 2 (include str fs maths) (assign input (fs::readIn "advent.txt")) (assign i 0) (assign resultone "") (assign resulttwo "") (assign resultthree "") (assign result 0) (assign currNum 1) (repeat (str::length input) (assign current (str::charAtIndex input i)) (if (eq current "x") (assign currNum (maths::add currNum 1)) | (if (eq current "\n") (assign currNum 1) (assign result (maths::add result (maths::add (maths::add (maths::multiply 2 (maths::multiply resultone resulttwo)) (maths::add (maths::multiply 2 (maths::multiply resulttwo resultthree)) (maths::multiply 2 (maths::multiply resultone resultthree)))) (maths::min (maths::multiply resultone resulttwo) (maths::multiply resulttwo resultthree) (maths::multiply resultthree resultone))))) (assign resultone "") (assign resulttwo "") (assign resultthree "") | (if (eq currNum 1) (assign resultone (str::concat resultone current))) (if (eq currNum 2) (assign resulttwo (str::concat resulttwo current))) (if (eq currNum 3) (assign resultthree (str::concat resultthree current))) ) ) (assign i (maths::add i 1)) ) (log result)