Clean up
This commit is contained in:
@ -7,14 +7,18 @@ DEBUG=false
|
|||||||
INCREMENT=1
|
INCREMENT=1
|
||||||
TAIL_NUM=16
|
TAIL_NUM=16
|
||||||
|
|
||||||
|
# Load registry values
|
||||||
REG_A=$(grep 'Register A:' "$FILE" | cut -f2 -d: )
|
REG_A=$(grep 'Register A:' "$FILE" | cut -f2 -d: )
|
||||||
REG_B=$(grep 'Register B:' "$FILE" | cut -f2 -d: )
|
REG_B=$(grep 'Register B:' "$FILE" | cut -f2 -d: )
|
||||||
REG_C=$(grep 'Register C:' "$FILE" | cut -f2 -d: )
|
REG_C=$(grep 'Register C:' "$FILE" | cut -f2 -d: )
|
||||||
|
|
||||||
|
# Rewrite registry A starting value
|
||||||
#REG_A=100000000000000
|
#REG_A=100000000000000
|
||||||
REG_A=164541160582800
|
REG_A=164541160582800
|
||||||
|
|
||||||
|
# Load input string
|
||||||
read -r -a INPUT <<< "$(grep 'Program:' "$FILE" | cut -f2 -d: | tr ',' ' ' )"
|
read -r -a INPUT <<< "$(grep 'Program:' "$FILE" | cut -f2 -d: | tr ',' ' ' )"
|
||||||
INPUT_LEN=${#INPUT[@]}
|
INPUT_LEN=${#INPUT[@]}
|
||||||
|
|
||||||
printf "Registers A: %s B: %s C: %s\n" "$REG_A" "$REG_B" "$REG_C" >&2
|
printf "Registers A: %s B: %s C: %s\n" "$REG_A" "$REG_B" "$REG_C" >&2
|
||||||
#printf "Input: " >&2
|
#printf "Input: " >&2
|
||||||
#printf "%s " "${INPUT[@]}" >&2
|
#printf "%s " "${INPUT[@]}" >&2
|
||||||
@ -23,17 +27,13 @@ printf "Registers A: %s B: %s C: %s\n" "$REG_A" "$REG_B" "$REG_C" >&2
|
|||||||
# Load machine operations
|
# Load machine operations
|
||||||
. machine.sh
|
. machine.sh
|
||||||
|
|
||||||
#while ! check_quine
|
# Iterate registry A until last nth digits are matched
|
||||||
while ! check_tail "$TAIL_NUM"
|
while ! check_tail "$TAIL_NUM"
|
||||||
do
|
do
|
||||||
read -r -a OUTPUT <<< "$( execute_machine )"
|
read -r -a OUTPUT <<< "$( execute_machine )"
|
||||||
printf "Register A: %s\n" "$REG_A"
|
printf "Register A: %s\n" "$REG_A"
|
||||||
printf "Output:\t"
|
printf "Output:\t"
|
||||||
#printf "%s " "${OUTPUT[@]}"
|
printf "%s " "${OUTPUT[@]}"
|
||||||
for i in "${OUTPUT[@]}"
|
|
||||||
do
|
|
||||||
printf "%s " "$i" # Print octal representation
|
|
||||||
done
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "Input:\t"
|
printf "Input:\t"
|
||||||
printf "%s " "${INPUT[@]}"
|
printf "%s " "${INPUT[@]}"
|
||||||
|
Reference in New Issue
Block a user