diff --git a/2020/5/hello-world b/2020/5/hello-world new file mode 100755 index 0000000..acf4023 Binary files /dev/null and b/2020/5/hello-world differ diff --git a/2020/5/hello-world.o b/2020/5/hello-world.o new file mode 100644 index 0000000..e979209 Binary files /dev/null and b/2020/5/hello-world.o differ diff --git a/2020/5/hello-world.pas b/2020/5/hello-world.pas new file mode 100644 index 0000000..6465c5f --- /dev/null +++ b/2020/5/hello-world.pas @@ -0,0 +1,38 @@ +PROGRAM Hello; + +VAR + filein : text; + mychar : char; + highest, column, row, pass : integer; + +BEGIN + highest := 0; + column := 0; + row := 0; + + assign(filein, 'input'); + reset(filein); + repeat begin + read(filein, mychar); + + case mychar of + 'F': row := row shl 1; + 'B': row := (row shl 1) or 1; + 'L': column := column shl 1; + 'R': column := (column shl 1) or 1; + otherwise begin + pass := row * 8 + column; + + if pass > highest then + highest := pass; + + row := 0; + column := 0; + end + end; + end; + until eof(filein); + close(filein); + + writeln('Largest boarding pass found is ', highest); +END. diff --git a/2020/5/input b/2020/5/input new file mode 100644 index 0000000..1b2e977 --- /dev/null +++ b/2020/5/input @@ -0,0 +1,771 @@ +FFBFFBFLLR +BFBFBFBRLR +FBFFBFBRRL +BBFFFBFLLR +BFFFFFBLRL +BFBBFBBRLR +FBFBFBBRRL +FBBBFBFLRL +BFFFFBBRRL +FBBBBBFLLR +FBFFFBFLLR +FFBBBFBLRR +BFFFBBFLRL +FFBBBFBLLL +FBFBBFFLRR +FBFBBBBLLR +FFBBBFFRLR +FBFBBFFRRL +FBBBFFFLRR +FFBBFFBLLR +BFBFBFBLLR +BFBBFFFLLL +FBFBBFBRRL +FFBBFFBLRR +FFFBFBBLRR +FFFFBBBRRL +BFBBBBFRLL +FBFBBFFLLR +FFFBFBBLLR +FFBFBBBRRL +BFFBBFFLLR +BFFFBBFLLR +FBBFBBFRRR +FFFBBFFRLL +BFBFBBFRRR +FBBFFBBRLR +FBFFBBFRRL +BFFFFBFLLR +BBFFBFBLRL +FBFBBBBLRL +FBFBFBFRL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