magic : 4 glasses trick

General FreeBASIC programming questions.
Post Reply
bluatigro
Posts: 660
Joined: Apr 25, 2012 10:35
Location: netherlands

magic : 4 glasses trick

Post by bluatigro »

Code: Select all

''bluatigro 28 jul 2017
''4 glasses

const as ulong cyan = rgb( 0 , 255 , 255 )
const as ulong yellow = rgb( 255 , 255 , 0 )

screen 20 , 32

dim as integer i
dim as string in

print:print:print
print "      Take 4 glasses and a bal and place them like : "

for i = 0 to 3 
  circle ( i * 128 + 256 , 200 ) , 50 , cyan ,,,1/4
  circle ( i * 128 + 256 , 600 ) , 50 , cyan ,,,1/4
  line ( i * 128 + 206 , 200 ) - step( 0 , 400 ) , cyan
  line ( i * 128 + 306 , 200 ) - step( 0 , 400 ) , cyan
next i

circle ( 256 , 550 ) , 30 , yellow ,,,, f

locate 40 , 10
input "[ pres return to cotinue . ]" ; in

cls
locate 30 , 10
print "Move the bal to a glass next its in ."
locate 32 , 10
print "And repeet this several times ."
locate 34 , 10
input "How many times did you move the bal ? " ; in
i = val( in )

cls
locate 30 , 10
if i and 1 then
  print "Remove the left most glass ."
else
  print "Remove the right most glass ."
end if

locate 35 , 10
print "[ pres return to continue . ]"
sleep

cls
locate 30 , 10
print "Move the bal 1 more time ."
locate 35 , 10
print "[ pres return to continue . ]"
sleep

cls
locate 10 , 10
print "Your bal is here :"

for i = 0 to 2
  circle ( i * 128 + 256 , 200 ) , 50 , cyan ,,,1/4
  circle ( i * 128 + 256 , 600 ) , 50 , cyan ,,,1/4
  line ( i * 128 + 206 , 200 ) - step( 0 , 400 ) , cyan
  line ( i * 128 + 306 , 200 ) - step( 0 , 400 ) , cyan
next i

circle ( 128 + 256 , 550 ) , 30 , yellow ,,,, f


locate 40 , 10
print "[ pres return to end program . ]"
sleep 
Post Reply