Saturday, November 15, 2014

for n = 0 to 10
pause 0.01
print "Benny ";
a=int(rand*3)
if a=0 then print "evolves ";
if a=1 then print "develops his work ";
if a=2 then print "has improved ";
a=int(rand*5)
if a=0 then print "brilliantely";
if a=1 then print "fantasticaly";
if a=2 then print "very well";
if a=3 then print "exeptionally";
if a=4 then print "with exellence";
print ". The homework is ";
a=int(rand*5)
if a=0 then print "marvellous.";
if a=1 then print "a true wonder.";
if a=2 then print "outstanding.";
if a=3 then print "unique.";
if a=4 then print "beautifull.";
a=int(rand*3)
if a=0 then print "We trust ";
if a=1 then print "We assume ";
if a=2 then print "We believe ";
a=int(rand*4)
if a=0 then print "he will achive ";
if a=1 then print "he is going to get ";
if a=2 then print "he will get ";
if a=3 then print "he is going to attain ";
a=int(rand*4)
if a=0 then print "fantastic results."
if a=1 then print "high grades."
if a=2 then print "lots of As."
if a=3 then print "tonnes of A*s."
next n

# One can change the order of the levels here
gosub first
gosub waitfordirection
gosub new
gosub two
gosub waitfordirection
gosub new
gosub three
gosub waitfordirection
gosub new
gosub four
gosub waitfordirection
gosub new
gosub five
gosub waitfordirection
color white
font "arial",50,100
Text 170,200,"Hurray"
refresh
end
end

# These are the 5 levels it is easy to make more
first:
balls=2
tries=2
mass[0]=10: x[0]=250: y[0]=250
mass[1]=10: x[1]=100: y[1]=100
mass[2]=10: x[2]=400: y[2]=400
return

round:
tries=tries-1
do
gosub drawtable
for u = 0 to 19
# balls out
goingout=false
if mass[u]>0 and (x[u]>450 or x[u]<50 or y[u]>450 or y[u]<50) then
goingout=true
mass[u]=mass[u]-1
if mass[u]=0 then
goingout=true
out = out + 1vx[u]=0vy[u]=0y[u]=0x[u]=0end if# White outif u = 0 then gosub finish
end if

for marble = 0 to 19
total_speed=total_speed+abs(vx[marble])+abs(vy[marble])
next marble
until total_speed<1 and goingout=false
if tries = 0 and out < balls then gosub finish
# reset the marble for the next round
for marble = 0 to 19
vx[marble]=0
vy[marble]=0
next marble
return

if a$[h,v]="" then
a$[h,v]= question$
value[h,v]= int(answer$)
Q = 1
end if
until Q =1
#selecting 1 card for answer
A =0
do
v=int(rand*3)
h=int(rand*4)
if a$[h,v]="" then
a$[h,v]= answer$
value[h,v]= int(answer$)
A = 1
end if
until A =1
QA =QA +2
end if
until QA = 12

humanplay:
p=0
p$=""
clickclear
do
if clickx >30 and clicky >60 and (clickx +clicky)<470 then
if clickx<370 then p$="g"
if clickx<320 then p$="f"
if clickx<270 then p$="e"
if clickx<220 then p$="d"
if clickx<170 then p$="c"
if clickx<120 then p$="b"
if clickx<70 then p$="a"

row=floor((clicky-55)/50)

If p$ = "a" then p=a-row
If p$ = "b" then p=b-row
If p$ = "c" then p=c-row
If p$ = "d" then p=d-row
If p$ = "e" then p=e-row
If p$ = "f" then p=f-row
If p$ = "g" then p=g-row

If p$ = "a" then a=a-p
If p$ = "b" then b=b-p
If p$ = "c" then c=c-p
If p$ = "d" then d=d-p
If p$ = "e" then e=e-p
If p$ = "f" then f=f-p
If p$ = "g" then g=g-p
end if
pause .1

Saturday, April 13, 2013

# The cellular automation program was malfunctioning for a long time because I did not update the code for the New Basic 256 version .
# This is a new version where the chaotic rule and the fractal rule are used different alternating patterns.
#http://mathworld.wolfram.com/ElementaryCellularAutomaton.html

fastgraphics
graphsize 600,300
For n = 1 to 300
plot (300,1)
Print "Fractal rule every "+n+" rows"
For y = 1 to 300
For x = 1 to 600
a=0
if pixel(x-1,y)=black then a=a+1
if pixel(x,y)=black then a=a+10
if pixel(x+1,y)=black then a=a+100

if y/n = int (y/n) then
gosub fractal
else
gosub chaotic
end if

next x
refresh
next y
refresh
clg
next n

chaotic:
if a=001 or a=110 or a =010 or a=100 then plot (x,y+1)
return
fractal:
if a=001 or a=010 or a=100 then plot (x,y+1)
return