Small Basic Programs in 25 lines

Note: All the programs listed below can be downloaded directly into Small Basic.  Just import the programs using their published Id.

What started as a fun challenge in our Small Basic Forums, quickly turned into a repository of very interesting programs, all conforming to a 25-line limit.  It is amazing to see enthusiastic participants come up with very creative patterns to embed complex logic in as few lines as possible.

The challenge started with the classic game of Rock/Paper/Scissors, written in 24 lines by Coding Cat and published as CTB433.  This was meant to be just an example for the challenge, but within days, Jason Jacques posted a 9 line version of the same program, published as CTB433-1.  And the race was on.

Recently Rushworks posted a trick to initialize Small Basic arrays in a single line.  Hours later, Davey-Wavey came up with a feature-par version of the original Rock/Paper/Scissors in 3 lines flat!  This version is published as CTB433-2.


And using a few tricks and assumptions about the size of the text window, Jason came back and posted the same program in just 2 lines!  It is published as CTB433-5.

As this race was going on, litdev published the Swarm of Bees as MSH031 in 25 lines.25line_2

Simultaneously, Dudeson published a similar program, RRS083 which simulates an atom with the mouse center as the nucleus.  And Grzegorz Tworek, published his Lissajou’s Curve simulator program as GQP876, in 11 lines. 


Dudeson went back and improved his atom code to publish RPW587, which runs much faster.


Other programs that you’ll find on this forum:

Sudoku Solver

(25 lines)
by Jason Jacques: CGW786


Sub Hunt

(25 lines)
by Coding Cat: KDN168
also by Davey-Wavey: KDN168-0


Space Invaders

(20 lines)
by Davey-Wavey: XDK444


Comments (17)

Cancel reply

  1. anonymouscommenter says:

    SBace-Invaders is now improved, and shrunk to 18 lines: SPR072

  2. anonymouscommenter says:

    I think this site is great. I’m just learning.

  3. futrePro says:

    Rock paper, scissors shortened to 19 lines and better yet. use code


  4. futrePro says:

    Dictionary in 8 lines! use code BTP350

  5. futrePro says:

    Dictionary in 7 lines and better yet! use code BTP350-1

  6. futrePro says:

    Dictionary in 6 lines! Use code FKP983

  7. futrePro says:

    Rock paper, scissors shortened to 12 lines!. use code CTB433-29

  8. anonymouscommenter says:

    I'm looking for a sample program that creates multiple text input boxes in which you input numerical data. The data is read from each input box so calculations may be performed on the input.

  9. anonymouscommenter says:

    where the hell are the full programs

  10. anonymouscommenter says:

    how do i move an object that has already been printed from memory onto the screen? ie an animal has been printed on a blank screen and now i want to move it from one side of the screen to another using x and y coordinates. what is the command?

  11. anonymouscommenter says:


    one line of code to get dictionary definition…

  12. anonymouscommenter says:

    Where do i go to download something

  13. anonymouscommenter says:

    put the code!!!!!!

  14. anonymouscommenter says:

    Where do I go to download something?

    Ans. Put the Code.

    Q Put the Code where? How?

  15. anonymouscommenter says:

    FNB377 2 lines for dictionary

  16. anonymouscommenter says:

    FPM739 Vowel and Consanant counter

    Browser needs game extension:

    GameWindow.Height = Desktop.Height

    GameWindow.Width = Desktop.Width

    GameWindow.BackgroundColor = "Black"


     Web = ""

    Browser = GameControls.AddWebBrowser(0, 0, GameWindow.Width, GameWindow.Height – 40, Web)

    WebBar = GameControls.AddTextBox("http://", GameWindow.Width – 1214,GameWindow.Height -35, 700, 30)

    Enter = GameControls.AddButton("Go" GameWindow.Width – 514, GameWindow.Height-35, 100, 30)

    Zoom_Control_Bar = GameControls.AddSlider(100,GameWindow.Width – 120,GameWindow.Height – 30,100,20)

    Sub Browsing

        website = GameControls.GetText(WebBar)

        GameControls.SetValue(Browser,website) 'use gamecontrols.setvalue function to set the url

        GameWindow.Title = website

        For i = 1 To 10000   'Not accurate but a webpage should load in 10 seconds

          val = i * 100 / 10000

          GameControls.SetText(Enter,"Loading "+math.Round(val))




  17. anonymouscommenter says:

    A forever-looping Rock Paper Scissors CTB433-47

Skip to main content