======dsr1====== =====Table===== ^ A ^ B ^ AND ^ OR ^ XOR ^ NAND ^ NOR ^ XNOR ^ | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | ^ A ^ NOT ^ | 0 | 1 | | 1 | 0 | =====bitwise AND===== One way to do AND two values is manually. One thing to keep in mind when doing it manually is that your numbers have to be the same length. One way to do that is to set a max length and then print it while padding it with spaces or zeros and capturing that output into a variable. Do this with both randomly generated numbers. Then you can read each variable character by character against the other and do you operation on them. For example (in bash): for(( jndex=0; jndex<16; jndex++ )) do if [[ "${array1[$jndex]}" == 1 ]] && [[ "${array2[$jndex]}" == 1 ]] ; then VarArray+=1 else VarArray+=0 fi done This is done for the programs answers to then check your user provided answer against later in the code. You can also use bash pockets of arithmetic to do any of the bitwise operations, although they are very picky with number bases, so you will have to convert your numbers being compared into decimal to convert, then back into their base after doing logic. One way you can go about this is like this: echo "obase=${ORIGINBASE}; $(( $(echo "obase=10; ibase=${ORIGINBASE}; ${FIRSTNUMBER}" | bc) & $(echo "obase=10; ibase=${ORIGINBASE}; ${SECONDNUMBER}" | bc) ))" | bc =====bitwise iOR===== You can use the same method(s) for iOR as you did with and, as the manual method works by giving it the cases for the operation, similarly to a truth table, and the pocket of arithmetic has a built in iOR operation "|" =====bitwise XOR===== You can use the same method(s) for iOR as you did with and, as the manual method works by giving it the cases for the operation, similarly to a truth table, and the pocket of arithmetic has a built in iOR operation “^” =====bitwise NOT===== echo 01010101 | tr '10' '01' or you can do tr '01' '10' both just flips it If you use the bitwise NOT operation ~ (such as ~number1) and you do not want to use tr to flip the result, you can also use ‘and’ masking. ''(1< A / 5 -> 5 In binary: 1010 / 0101 NEW base = 8 Together: 010100101 (ADD A ZERO TO THE FRONT TO MAKE 9 DIGITS, bc 2^3 = 8 <- NEED SETS OF 3) The player needs to break this down mentally into 010 100 010 -> 2 4 5 The answer: 245 What the player will see: 2 nibbles in base16: A and 5 ANSWER: 245 Part 2: -Generate random binary number (ideally 4,8,12,16) digits in length -Generate second binary number in same length -Do bitwise logic on it What the player will see: 1010 && 0110 ==== 0010 Let part 1 be something of a warmup. After X rounds, part 2 should kick in