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.
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
Anonymous
November 16, 2009
SBace-Invaders is now improved, and shrunk to 18 lines: SPR072Anonymous
January 03, 2010
I think this site is great. I'm just learning.Anonymous
March 31, 2010
Rock paper, scissors shortened to 19 lines and better yet. use code CTB433-16Anonymous
April 13, 2010
Dictionary in 8 lines! use code BTP350Anonymous
April 15, 2010
Dictionary in 7 lines and better yet! use code BTP350-1Anonymous
April 20, 2010
Dictionary in 6 lines! Use code FKP983Anonymous
June 30, 2010
Rock paper, scissors shortened to 12 lines!. use code CTB433-29Anonymous
September 23, 2010
The comment has been removedAnonymous
February 14, 2011
The comment has been removedAnonymous
May 11, 2011
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?Anonymous
December 31, 2011
The comment has been removedAnonymous
February 24, 2012
Where do i go to download somethingAnonymous
February 28, 2012
put the code!!!!!!Anonymous
April 04, 2012
Where do I go to download something? Ans. Put the Code. Q Put the Code where? How?Anonymous
April 11, 2012
FNB377 2 lines for dictionaryAnonymous
April 11, 2012
FPM739 Vowel and Consanant counter Browser needs game extension: GameWindow.Height = Desktop.Height GameWindow.Width = Desktop.Width GameWindow.BackgroundColor = "Black" GameWindow.Show() Web = "google.com" 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)) EndFor GameControls.SetText(Enter,"Go") EndSubAnonymous
May 14, 2014
A forever-looping Rock Paper Scissors CTB433-47