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
#!/bin/bash | |
set -u | |
set -o pipefail | |
inbounds() { | |
local x=$1 y=$2 | |
return $((x < 0 || x >= cols || y < 0 || y >= rows ? 1 : 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
#!/bin/bash | |
set -u | |
set -o pipefail | |
inbounds() { | |
local x=$1 y=$2 | |
return $((x < 0 || x >= cols || y < 0 || y >= rows ? 1 : 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
#!/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 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 batchsizes recipes | |
batchsizes[FUEL]=1 | |
batchsizes[ORE]=1 | |
recipefile=$(dirname "$0")/recipes.sh | |
parse() { | |
local reaction |
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
#!/bin/bash -eu | |
declare -A stockpile batchsizes recipes | |
startingore=1000000000000 | |
stockpile[ORE]=$startingore | |
stockpile[FUEL]=0 | |
batchsizes[ORE]=1 | |
recipefile=$(dirname "$0")/recipes.sh |
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
#!/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 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 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 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 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 |