We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 400
» Latest member: Lilongjia
» Forum threads: 147
» Forum posts: 1,841

Full Statistics

Online Users
There are currently 169 online users.
» 0 Member(s) | 166 Guest(s)
Applebot, Bing, Google

Latest Threads
Creation of SB-Neuron. Ou...
Forum: Discussion
Last Post: AbsoluteBeginner
47 minutes ago
» Replies: 60
» Views: 5,432
Added this forum in Wikip...
Forum: Discussion
Last Post: Independentqlc
03-26-2025, 11:57 AM
» Replies: 1
» Views: 471
LDDataBase.EditTable(data...
Forum: Extensions
Last Post: litdev
03-23-2025, 11:08 AM
» Replies: 4
» Views: 102
3D maze in browser contro...
Forum: Discussion
Last Post: litdev
03-22-2025, 03:17 PM
» Replies: 127
» Views: 6,966
some help - part one
Forum: Standard Small Basic
Last Post: Yumda
03-22-2025, 09:16 AM
» Replies: 7
» Views: 177
LitDev Extension version ...
Forum: Extensions
Last Post: litdev
03-21-2025, 02:27 PM
» Replies: 5
» Views: 204
AI learns Small Basic
Forum: Discussion
Last Post: z-s
03-15-2025, 03:37 AM
» Replies: 36
» Views: 2,028
LDdictionary not working
Forum: Discussion
Last Post: jrmrhrb00
02-27-2025, 04:17 PM
» Replies: 32
» Views: 1,706
Challenge 12 - Rotating t...
Forum: Challenges
Last Post: AbsoluteBeginner
02-24-2025, 11:42 AM
» Replies: 9
» Views: 410
Small basic feature.
Forum: Discussion
Last Post: z-s
02-24-2025, 10:22 AM
» Replies: 4
» Views: 417

 
  Small Basic 1.2
Posted by: jrmrhrb00 - 11-23-2024, 12:26 AM - Forum: Standard Small Basic - No Replies

I was doing a little research on small basic. Level 1.2 was released on Oct. 1, 2015. Small Basic was actually an idea way back in 2008. That is when Microsoft started developing it. To see how I figured this out in your url type "Way Back Machine". It will load a web page. Then click on Wayback Machine again. It loads a new page and from it, it wants you to enter a url. Type in Smallbasic.com.at the top of that it shows a calendar. The first entries for the calendar start in 2008.

If you select one of the entries in the calendar it will bring up a smallbasic.com webpage. Look at that page and find where it says "need help". Click on that and it takes you into the old forum. Some of the links work in the forum and some don't. It depends on if it was archived. So, we can get into some parts of the old forum through the "Way Back Machine"! The "Way Back Machine" is basically an archive of what was on the internet at that point in time. Not everything was archived, but a lot of it was.

JR

Print this item

  SB.js
Posted by: z-s - 11-22-2024, 05:51 AM - Forum: Discussion - Replies (6)

this is work in progress for SB.js for executing the sb on browser.
put your sb code in the div section:

PHP Code:
<!DOCTYPE html>
<
html lang="en">
<
head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SB.js Executor</title>
</
head>
<
body>
    <h1>SB.js Executor</h1>

    <!-- Small Basic code goes here -->
    <div class="SB">
        x 2
ar_ind 
1
        y 
x
        TextWindow
.WriteLine(y)
hello[ar_ind] = "hii"
TextWindow.WriteLine(hello[1])
    </div>

    <script>
        arrays = []
// Run the SB code when the page loads
        window.onload runSBCode;

        // Main execution function
        function runSBCode() {
            // Extract code from the div with class "SB"
            const codeDiv document.querySelector(".SB");
            const code codeDiv.textContent.trim().split("\n").map(line => line.trim());  // Split by newline
const arrayRegex = /([a-zA-Z_][a-zA-Z0-9_]*)\[\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\]/;

            code.forEach(line => {
                if (line) {

    const arrayMatch line.match(arrayRegex);
                    if (arrayMatch) {
                        const arrayName arrayMatch[1]; // Extract array name
                        if (!arrays.includes(arrayName)) {
                            eval(`${arrayName} = []`);  // Initialize the array
arrays.push(arrayName);  // Store the array name
                        }
                    }

                    // Check if the line is a TextWindow.WriteLine command
                    if (line.startsWith("TextWindow.WriteLine")) {
                        // Extract the content within the parentheses
                        const match = line.match(/TextWindow\.WriteLine\((.*)\)/);
                        if (match) {
                            const content = match[1].trim();
                            // Replace TextWindow.WriteLine with console.log
                            const jsCode = `console.log(${content})`;
                            eval(jsCode);  // Execute the JavaScript code
                        }
                    } else {
                        // If it's just a normal SB code line, try to eval it directly
                        try {
                            eval(line);  // Execute the Small Basic line as JavaScript
                        } catch (e) {
                            console.log(`Error in executing: ${line} - ${e.message}`);
                        }
                    }
                }
            });
        }
    </script>
</
body>
</
html
and see the result in console but only array ,variables and TextWindow.WriteLine() is currently working nothing else.
   

good ui and more coming soon.

Print this item

  LDArray extension
Posted by: Yumda - 11-17-2024, 10:05 PM - Forum: Extensions - Replies (17)

Hi All...

This may seem like a dumb question... but

Having trouble understanding how to use the LDarray extension.  There is no examples, do you think you can give me some example?

I am having trouble to even create one using the ldarray extension, normal Sb array is fine, but just don't seem to get ldarray to work.

Thanks you all for helping and your time in advance.

Regards

Print this item

  How to exit a subroutine half way through
Posted by: Yumda - 11-11-2024, 01:48 AM - Forum: Standard Small Basic - Replies (2)

Hi there:

Just not sure if this is possible with small basic.

Been trying to exit a subroutine half way through but so far does not have much success, any ideas ?

All help is much appreciated.

Regards

Print this item

  Challenge 9 - Quick sort
Posted by: litdev - 10-28-2024, 08:41 AM - Forum: Challenges - Replies (54)

Implement quicksort algorithm and sort 1000 random numbers.

Interesting to see if it's easier the usual way understanding the algorithm and writing the code or getting AI to do it for you?

Print this item

  SB-Prime Plugins
Posted by: z-s - 10-25-2024, 04:42 AM - Forum: Extensions - Replies (1)

what are sb prime plugins could you explain in detail nothing on this repo.
litdev1/SBSamplePlugin: Sample for SB-IDE plugin (github.com)

Print this item

  AI learns Small Basic
Posted by: AbsoluteBeginner - 10-24-2024, 01:02 PM - Forum: Discussion - Replies (36)

(translated by Google translator)

Hi all.  Shy
One day, I was sitting in front of the monitor and feeling sad. Almost no one on our forum writes anything, says anything, or asks anything.
In this situation, I couldn't even bring myself to create a demo program. I thought, why create a program if no one is interested in it.

Then I thought that I could call my Copilot for help.
Copilot proudly declared that he could write code in Small BASIC and knew the LitDev library.
I thought that if people are too lazy to write code in Small BASIC themselves, then maybe they would be interested in writing code with the help of AI.

Therefore, I suggest you a new topic where you can talk about your achievements in teamwork with AI.

( this is now fashionable Wink )

Print this item

  Challenge 8 - Drag n Drop
Posted by: litdev - 10-20-2024, 12:19 PM - Forum: Challenges - Replies (7)

Make a Drag and Drop feature using the Mouse buttons to position a GraphicsWindow shape (Rectangle).

Extend it to rotate the shape when Shift key is down.

Print this item

  Decompile to C# in SB-Prime - Checkbox Console App
Posted by: Scout - 10-15-2024, 04:21 PM - Forum: C# Moving from Small Basic - Replies (3)

The Chess Engine SB_Scout is a mixed application with a text window and a graphics window. (PDVF923.000)
As it is not a pure console application, I have disabled the checkbox "Export as Console App".
Is the following error related to this or is there another cause?


   

Print this item

  SmallBasic Open Edition
Posted by: KristianVirtanen - 10-13-2024, 04:41 PM - Forum: C# Moving from Small Basic - Replies (21)

Hi,

This project (SmallBasic Open Edition) is part of a larger whole, where the goal is to recreate Microsoft SmallBasic, at least in its main features.

The first phase of the project, which is exactly this, is to create the same classes as in SmallBasic: Text, Math, GraphicsWindow, and so on. The project is mostly complete, although types for variables, some small tests, and so on are still required.

Note: The classes Array, Flickr, and Dictionary have not been created.

Array is missing because I have not yet decided on the final way the future compiler will handle arrays. I have a couple of different solutions for this, but I haven’t had time to decide yet. 

Flickr is missing because I am simply not very familiar with this service, and their API is completely unknown to me. 

Dictionary is a class I’m not sure if I want to spend time on, at least not personally.

Unlike the original SmallBasic, Open Edition converts SmallBasic code into the C# programming language and compiles it afterward. This brings significant advantages in terms of memory management, speed, and extensibility.

Variables will function mostly the same way as in the original SmallBasic. This is made possible by C#’s dynamic. However, the idea is that variables will require a suffix of "$" at the end of their names. Not only does this make the programs easier to compile, but I also believe it helps distinguish variables and makes coding a bit easier.

The program that tokenizes and converts SmallBasic code into C# is also mostly done. However, at the moment, it's more like a pile of sticks rather than a well-designed and structured program, so its release will be more appropriate at a later time.

Example SmallBasic program:

Code:
' Example Smallbasic program
x$ = 1
y$ = 2
c$ = "Foo"
TextWindow.WriteLine(x$ + y$ + c$)
SayHello()
Goto MyLabel:
TextWindow.WriteLine("I'm never printed.")
MyLabel:
Program.End()
Sub SayHello
    TextWindow.WriteLine("Hello")
EndSub

Converted to C#:

Code:
// Converted as C#
namespace SmallBasicOpenEditionDll
{
    public static class SB_Program
    {
        // Declare dynamic variables (similar to Smallbasic's dynamic typing)
        public static dynamic x = 1;
        public static dynamic y = 2;
        public static dynamic c = "Foo";
        // Entry point of the program
        public static void Main()
        {
            // Equivalent of TextWindow.WriteLine(x$ + y$ + c$)
            TextWindow.WriteLine(x + y + c);
            // Call the method SayHello()
            SayHello();
            // This line will not be executed
            Goto MyLabel:
            TextWindow.WriteLine("I'm never printed.");
            MyLabel:
            Program.End();
        }
        // The equivalent of SmallBasic's subroutine 'SayHello'
        public static void SayHello()
        {
            TextWindow.WriteLine("Hello");
        }
    }
}

Note: I work with this while I am working with two job's and such, so this will not move forward in fast speed. Help is appreciated here. Let me know Smile

Print this item