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
#!/bin/bash | |
set -eu | |
declare -ai input basepattern | |
read -r inputstr < "${1:?}" | |
for ((i=0; i < ${#inputstr}; i++)); do | |
input+=("${inputstr:$i:1}") |
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
#!/bin/bash -eu | |
declare -i width=80 height=50 x=40 y=20 nextx=40 nexty=19 input=1 dir=0 measuredist=0 maxdist=0 | |
declare -a world distances | |
for ((i=0; i < width * height; i++)); do | |
world[i]=' ' | |
distances[i]='.' | |
done |
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
#!/bin/bash -eu | |
declare -i width=80 height=50 x=40 y=20 nextx=40 nexty=19 input=1 dir=0 | |
world=$(yes ' ' | tr -d \\n | head -c $((width * height))) | |
declare -ai program ram | |
declare -i addrmode1 addrmode2 arg1 arg2 pc=0 rb=0 | |
IFS=, read -r -a program < "$1" | |
shift |
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
#!/bin/bash -eu | |
declare -ai program ram | |
declare -i addrmode1 addrmode2 arg1 arg2 pc=0 rb=0 | |
IFS=, read -r -a program < "$1" | |
shift | |
inputs=("$@") | |
ram=("${program[@]}") | |
ops=(x '+' '*' x x '-eq' '-ne' '<' '==') | |
while : ; do |
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
#!/bin/bash | |
set -eu | |
posx=() posy=() posz=() | |
velx=() vely=() velz=() | |
declare -i periodx periody periodz | |
t=0 |
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
#!/bin/bash | |
set -eu | |
posx=() posy=() posz=() | |
velx=() vely=() velz=() | |
t=0 | |
mapfile -t input < "$1" |
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
#!/bin/bash -eu | |
getloc() { | |
case $1 in | |
0) echo "$2" ;; | |
1) echo "Can't get location of immediate value" >&2 && exit 1 ;; | |
2) echo "$((rb + $2))" ;; | |
esac | |
} |
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
#!/bin/bash -eu | |
getloc() { | |
case $1 in | |
0) echo "$2" ;; | |
1) echo "Can't get location of immediate value" >&2 && exit 1 ;; | |
2) echo "$((rb + $2))" ;; | |
esac | |
} |
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
#!/bin/bash -eu | |
getloc() { | |
case $1 in | |
0) echo "$2" ;; | |
1) echo "Can't get location of immediate value" >&2 && exit 1 ;; | |
2) echo "$((rb + $2))" ;; | |
esac | |
} |
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
#!/bin/bash -eu | |
declare -A stockpile batchsizes recipes | |
startingore=1000000000000 | |
stockpile[ORE]=$startingore | |
stockpile[FUEL]=0 | |
batchsizes[ORE]=1 | |
recipefile=$(dirname "$0")/recipes.sh |