I've been working for a while on this project its basically uses an electronic breadboard where it makes use of logic gates to control robotic tanks

The first image shows the design screen I'm not yet finished with but have drawn all-sorts of logic plans to help in the process ive attached an agc

file which allows for bitwise logic to be used. Worked on a similar version in past with blink in 3d but decided i needed to go back to the original

concept and start over

here is a test of bitwise logic

// Project: Test
// Created: 2022-06-26
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Bitwise test logic Test" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
do
//a 1|b=0
a=random2(0,2)
b=random2(0,2)
print ("Truth Table of gates using ")
Print (" a = " + str(a) + ": b = " + str(b))
print ("Test "+str(a)+ " and "+str(b) + " bitwise = " + str (BitwiseAnd(a,b)) )
print ("Test "+str(a)+ " or "+str(b) + " bitwise = " + str (BitwiseOr(a,b)) )
print ("Test "+str(a)+ " not "+str(b) + " bitwise = " + str (BitwiseNot(a,b)) )
print ("Test "+str(a)+ " nor bitwise = " + str(BitwiseNor(a)) )
if BitwiseNor(a) >0 then sleep (10000)
print ("Test "+str(a)+ " xnor "+str(b) + " bitwise = " + (BitwiseXnor(a,b)) )
print ("Test "+str(a)+ " xor "+str(b) + " bitwise = " + str (BitwiseXor(a,b)) )
Print( ScreenFPS() )
Sync()
loop
//a and b= 0 adding zero to a number must result 0
//a nor b = 0 a can never be not 0 inb resullt
//a xnor b =0 a cant be exclusively not 0 simultaneously
//b=1
//or
//1 and b =1 and 1 to a number will always be true
//1 or 1 = true unless both values are 1
//1 not 1 = 0 they are both different then result 1
// xnor 1 =1 (exclusively not both therefore true)
//1 xor 1 = 1 (exclusively) unless different
//Bitwise mathematics
function BitwiseAnd(x as integer,y as integer)
r as integer
r=x&&y
endfunction r
function BitwiseOr(x as integer,y as integer)
r as integer
r=x||y
endfunction r
function BitwiseNot(x as integer,y as integer)
r as integer
r=x<>y
endfunction r
function BitwiseNor(a as integer)
r as integer
l as string
l=str(a)
s as string
For i=len(l) to 0 step -1
s=(str(i)+"="+Bin(i))
next i
if val(s) then r=val(s,2)
endfunction r
function BitwiseXor(x as integer,y as integer)
r as integer
r=x^y
endfunction r
function BitwiseXNor(a as integer,b as integer)
r as integer
rs as string
d as integer
c as string
//c=str(BitwiseOr(a,b))
//r=(val(c,2))
r=a<>b^a<>b
rs=bin(r)
r=0^a<>b
r=val(str(r),2)
endfunction rs
function BitwiseToString(a as integer)
l as string
l=str(a)
s as string
For i=0 to len(l)
s=(str(i)+"="+Bin(i))
next i
endfunction s
/// >>>>>extras
function BitwiseShiftLeft(a as integer,value as integer)
if value=0 then exitfunction 0
r as integer
r=a<<value
endfunction r
function BitwiseShiftRight(a as integer,value as integer)
if value=0 then exitfunction 0
r as integer
r=a>>value
endfunction r
function BitwiseShift(a as integer, opp as integer, value as integer)
r as integer
if value=-0 then exitfunction 0
if Opp = 0 then exitfunction 0
if opp > 0
r=a>>value
exitfunction r
endif
if opp < 0
r=a<<value
exitfunction r
endif
endfunction 0 //(failed a variable needs setting to do this correct)

This screen is the screen where you can put your designed robot to the test

If anyone has either done similar or got some great idea that could help ide love to here the suggestions.

PK