I have been trying to pipe random data into a program that is suppose to predict the next correct number. I want to run a infinite loop pipe for option 1 which leads to option 2 with another option with c to continue. The reason for this is for the AI to be trained in predicting patterns found in random generated numbers.
NOTE: When, I say option 1 and option 2 i mean by selecting option 1 it will display the following options "enter number 1 and enter number 2.
This is what the program looks like in the shell.
Select your choice.
1. Enter the newest number.
2. Find a new number.
-------------------------------------------------------------------
Select your choice.
1. Enter the newest number.
2. Find a new number.
Enter number 1.
Enter number 2.
Enter c to continue or 0 to quite
Pipes that I tried to get to work, but failed.
./RNGAI | echo "1" | shuf -i 1-26 -n1 | echo "2" | shuf -i 1-26 -n1 | echo "c" | ./RNGAI
./RNGAI | echo "1" | echo $((RANDOM%10))| ./RNGAI & echo "2" | echo $((RANDOM%10)) & echo "c"
I have an error after trying some pipes. The pipes do technically work, however the RNGAI program throws errors show -nan every time it runs its loop with the pipe. Here are the pipes and scripts I tried to run
while true
do
echo 1
echo $ od -A n -N 2 -t u2 /dev/random
echo 2
echo $ od -A n -N 2 -t u2 /dev/random
echo c
done | ./RNGAI
Here are the pipes
while :; do printf "%s\n" 1 seq 1 26 | sort -R | head -n 1 2 seq 1 26 | sort -R | head -n 1 c; done | ./RNGAI
while :; do printf "%s\n" 1 od -A n -N 2 -t u2 /dev/random 2 $od -A n -N 2 -t u2 /dev/random c; done | ./RNGAI
while :; do printf "%s\n" 1 shuf -i 1-26 -n1 2 shuf -i 1-26 -n1 c; done | ./RNGAI
Error the RNGAI program throws
Select your choice.
1. Enter the newest number.
2. Find a new number.
Enter number 1.
Enter number 2.
-nan
-nan
Enter c to continue or 0 to quite
Enter number 1.
Enter number 2.
-nan
-nan