This file contains 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
<html> | |
<head> | |
<script src="html.js"></script> | |
<script> | |
function rotateRight(arr) { | |
arr.unshift(arr.pop()); | |
} | |
function rotateLeft(arr) { | |
arr.push(arr.shift()); | |
} |
This file contains 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
// Advent of Code 2023. Day 6: Wait For It | |
// dotnet fsi aoc06.fsx | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let parse (s : string) : string list = | |
Regex.Matches(s, "\d+") | |
|> Seq.map (fun m -> m.Value) |
This file contains 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
// Advent of Code 2023. Day 5: If You Give A Seed A Fertilizer | |
// dotnet fsi aoc05.fsx | |
open System.IO | |
open System.Text.RegularExpressions | |
let parseNumbers (s : string) : int64 list = | |
Regex.Matches(s, "\d+") | |
|> Seq.map (fun m -> int64 m.Value) | |
|> Seq.toList |
This file contains 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
// Advent of Code 2023. Day 4: Scratchcards | |
// dotnet fsi aoc04.fsx | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let parseCard (line : string) : int = | |
let folder (seen, dups) x = | |
if List.contains x seen then (seen, x :: dups) else (x :: seen, dups) |
This file contains 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
// Advent of Code 2023. Day 3: Gear Ratios | |
// dotnet fsi aoc03.fsx | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
type Box = { | |
xMin : int | |
yMin : int |
This file contains 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
% Advent of Code 2023. Day 2: Cube Conundrum | |
% gs -DNOSAFER aoc02.ps | |
/read-input | |
{ % fn | |
[ % fn [ | |
exch % [ fn | |
(r) file % [ F | |
{ | |
dup % [ .. F F |
This file contains 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
// Advent of Code 2023. Day 1: Cube Conundrum | |
// dotnet fsi aoc02.fsx | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let getCount (m : Match) : int = | |
m.Groups[1].Value |> int |
This file contains 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
% Advent of Code 2023. Day 1: Trebuchet?! | |
% gs -DNOSAFER aoc01.ps | |
/read-input | |
{ % fn | |
[ % fn [ | |
exch % [ fn | |
(r) file % [ F | |
{ | |
dup % [ .. F F |
This file contains 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
# Advent of Code 2023. Day 1: Trebuchet?! | |
# tclsh aoc01.tcl | |
set fp [open "input" r] | |
set fileData [read $fp] | |
close $fp | |
proc toNumber {numbers} { | |
set result 0 | |
if {[llength $numbers] > 0} { |
This file contains 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
10 REM AFTERMATH OF THE ASIMOVIAN DISASTER | |
20 GOSUB 2600:REM INITIALISE | |
30 GOSUB 160 | |
35 IF RO=13 THEN QQ=QQ+1:IF QQ=2 THEN 1385 | |
40 GOTO 30 | |
150 REM ************************** | |
160 REM MAJOR HANDLING ROUTINE | |
170 STRENGTH = STRENGTH - 5 | |
180 IF STRENGTH<10 THEN PRINT "WARNING, CAPTAIN ";N$;", YOUR STRENGTH":PRINT " IS RUNNING LOW":PRINT" YOU NEED AN OXYGEN BOOST" | |
190 IF STRENGTH < 1 THEN 2300:REM DEATH |