Code library additions

Forums: 

Oh I am getting behind.

Here is list of latest additions (more to come from Forum Discussions most current page):

Graphics3 section:
Bomb.bas by MGA
Pi roll.bas by MGA
Eye of the Storm.bas by Rick3137 (Doodlebot2)
Star Worlds.bas by MGA

Games2 section:
Memory Match Game by MGA

If I have missed anything before most current page in General Discussion of Forum, let me know. -> MGA

Also, I currently can't test code on Android device. If anyone has code that is sure to work on Android devices, I can add it to On-line samples. eg does NIM work OK and should it be added?

NIM was developed/translated entirely on:
Android 4.1.1 - on Prestigio multiPad PMP5770D
so it works perfectly on this device....

As it is 'bare' code (no forms, no window), I believe it should work on any Android device...
so it can be freely added to on-line samples...

thanks for your effort
regards, jsalai

I could not imagine this program would advance that much :)
So I made a few small changes. If you find it better, please replace the 'originals' with this:

?"Nim is a mathematical game of strategy in which two"
?"players take turns removing objects from distinct"
?"heaps. On each turn, a player must remove at least"
?"one object, and may remove any number of objects"
?"provided they all come from the same heap. The goal"
?"of the game is to be the player to remove the last"
?"object. (https://en.m.wikipedia.org/wiki/Nim)":pause
' Here the program I wrote back in 80's for ZX-Spectrum
' adapted for SB
while 1
  cls
  p=1
  randomize
  input "NIM - No of heaps(3-9): ",n
  if n<3 or n>9 then stop
  ?"heaps coins"
  dim d()
  w=seq(1,15,15)
  m=len(w)
  while n
    x=int(rnd*m)
    d << w(x)
    m--
    n--
    swap w(m),w(x)
  wend
  sort d
  while 1
    locate 3,0
    i=0
    for x in d
      i++
      ?usg"###. ### ";i;x;
      ?string(x,"o");spc(15-x)
    next
    for i=i to 9 do ?spc(40)
    if p
      gosub 20
    else
      gosub 30
    fi
    if d(a)=0 then delete d,a
    if len(d)=0 then exit loop
    p=!p
  wend
  ?iff(p,"Player","Computer")+" wins! Press a key"
  pause
wend

20
  while 1
    k=0:a=0
    while a=0
      locate 15,0
      ?"Your move (0-hint, 99-end): "
      input "from heap:",a
      if a=0
        x=0
        for y in d do x=x xor y
        if x
          ?"the NIM (aka XOR) sum is ";x
          ?"Your goal is to make this sum 0."
        else
          ?"sorry, there is no hope anymore"
        fi
        pause:locate 17,0:?spc(40):?spc(40)
      fi
    wend
    if a=99 then stop
    if a and a<=len(d)
      a--
      while k=0
        locate 17,0
        input "       no:",k
        if k=99 then stop
        if k<1 or k>d(a) then k=0
      wend
      d(a)=d(a)-k
      exit loop
    fi
  wend
  locate a+3,0
  ?usg;a+1;d(a);
  if d(a) then ?string(d(a),"o");
  ?string(k,".")
  locate 18,0
  ?"Press a key":pause
  locate 15,0
  for i=1 to 4 do ?spc(40)
return

30
  x=0
  for y in d do x=x xor y
  if x
    a=0
    while 1
      m=x xor d(a)
      if m<=d(a)
        k=d(a)-m
        d(a)=m
        exit loop
      fi
      a++
    wend
  else
    a=int(rnd*len(d))
    k=int(rnd*d(a))+1
    d(a)=d(a)-k
  fi
  locate a+3,0
  ?usg;a+1;d(a);
  if d(a) then ?string(d(a),"o");
  ?string(k,".")
  locate 15,0
  ?"My move: from ";a+1;", ";k;" coins"
  ?"Press a key"
  pause
return

I've yet to beat this thing but have yet to really study it.

I do like the hints, though not pleased to learn "there is no hope" but like the 99 option. ;)

About "no hope"
Neither do I like this message, but it is the sad truth... As Plato:
"I like Socrates, but even more I like the truth"
I hope, soon enough, this message will be rare, ie. the player will recognize the hopeless situations :)
The real 'purpose' of this is to learn 'xor'ing by heart, and then beating human opponents...