hey

  • 12 Replies
  • 352 Views
*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
hey
« on: December 11, 2019, 05:19:47 PM »
hi guys
I'm back
Thinkbots are free, as in 'free will'

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6742
  • Mostly Harmless
Re: hey
« Reply #1 on: December 11, 2019, 05:22:17 PM »
Welcome back Zero  :)

*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
Re: hey
« Reply #2 on: December 11, 2019, 05:50:25 PM »
How are you Freddy? :)
Thinkbots are free, as in 'free will'

*

ivan.moony

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1358
    • e-teoria
Re: hey
« Reply #3 on: December 11, 2019, 06:09:42 PM »
Hi  :)

Long time no see...

Are there any cool projects?
Dream big. The bigger the dream is, the more beautiful place the world becomes.

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6742
  • Mostly Harmless
Re: hey
« Reply #4 on: December 11, 2019, 06:20:09 PM »
How are you Freddy? :)

I'm good thanks, not doing much programming at the moment, but have a new game to work on when I get some free time. It's in the coming up with ideas stage.

Got anything you are working on now?

*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
Re: hey
« Reply #5 on: December 11, 2019, 06:54:17 PM »
Not really... Hi Ivan :)

Right now I'm screwing around, downgrading Javascript so it looks like 80's unstructured BASIC.

Sticking this into an .html file:

Code: [Select]
<!DOCTYPE html>
<html>
<head>
    <title>BASIC</title>
    <meta charset="utf-8">
    <style>
        html, body, body * {
            background: #005;
            color: #db9;
            font-family: Consolas, 'Lucida console', monospace, monospace;
            margin: 0;
            padding: 0;
            font-size: 16px;
            overflow-x: hidden;
            scrollbar-color: #444 transparent !important;
        }
        #term-output {
            white-space: pre-wrap;
        }
        #term-input {
            border: none;
            width: 100vw;
        }
    </style>
    <style id="paper-style">
        html, body, body * {}
    </style>
</head>
<body>
    <pre id="term-output"></pre><input type="text" id="term-input">

    <script>

    String.prototype.regexIndexOf = function(regex, startpos) {
        var indexOf = this.substring(startpos || 0).search(regex);
        return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf;
    }       

    var BASIC = {};
    var that;

    BASIC.color = "#db9";

    BASIC.program = {},
    BASIC.progPointer = "stop",
    BASIC.nextProgPointer = "stop";

    BASIC.subStack = [];

    const rem = function() {}

    const print = function(rawtxt) {

        var txt = (typeof rawtxt == "string" || typeof rawtxt == "number") ? rawtxt : JSON.stringify(rawtxt);
        BASIC.termOutput.innerHTML += `\n<span style="color:${BASIC.color};">${txt}</span>`;
        window.scrollTo(0,document.body.scrollHeight);
    }

    const pen = function(c) {

        BASIC.color = c;
    }

    const paper = function(b) {

        BASIC.paperStyle.innerHTML = `html, body, body * { background: ${b};}`;
    }

    const edit = function(lineNumber, instruction) {

        if (typeof instruction == "undefined") {

            BASIC.termInput.value = lineNumber+' '+BASIC.program[lineNumber];

        } else {

            BASIC.program[lineNumber] = instruction.trim();
        }
    }

    const run = function(start) {

        BASIC.progPointer = BASIC.orderedLines().filter(l => l >= (start || 0))[0];
       
        while (BASIC.progPointer) {
            BASIC.nextProgPointer = BASIC.orderedLines().filter(l => l > BASIC.progPointer)[0];
            that = BASIC.execute(BASIC.program[BASIC.progPointer]);
            BASIC.progPointer = BASIC.nextProgPointer;
        }

        BASIC.progPointer = "stop";
    }

    const goto = function(n) {

        BASIC.nextProgPointer = BASIC.orderedLines().filter(l => l >= n)[0];
    }

    const gosub = function(n) {

        BASIC.subStack.push(BASIC.progPointer);
        BASIC.nextProgPointer = BASIC.orderedLines().filter(l => l >= n)[0];
    }

    const end = function(n) {

        var previous = BASIC.subStack.pop();
        BASIC.nextProgPointer = BASIC.orderedLines().filter(l => l > previous)[0];
    }

    const list = function(rawStart, rawEnd) {

        var lineList = BASIC.orderedLines();
       
        var start = rawStart || lineList[0];
        var end = rawEnd || lineList[lineList.length-1];

        lineList.filter(l => l >= start && l <= end).forEach(l => { print(l+' '+BASIC.program[l]); });
    }

    const cls = function() {
        BASIC.termOutput.innerHTML = '';
    }

    BASIC.execute = function(rawloc) {

        var result;
        var loc = rawloc+' ';

        try {
            var verb = loc.substr(0, loc.regexIndexOf(/[ =]/));
            var args = eval('['+loc.substr(verb.length)+']');
            result = eval(verb).apply(null, args);
            var success = true;
        } catch(e) {}
        if (!success) {
            try{
                result = eval(loc);
            } catch(e) {
                print((BASIC.progPointer == "stop" ? '' : `line ${BASIC.progPointer}, `) + e.message);
            }
        }
        return result;
    }

    BASIC.evalInput = function(cmd) {

        print(cmd);
        BASIC.termInput.value = '';

        var first = cmd.substr(0, cmd.indexOf(' '));
        var lineNumber = parseInt(first);
        if (first.length > 0 && !isNaN(lineNumber)) {

            edit(lineNumber, cmd.substr(first.length));

        } else {

            that = BASIC.execute(cmd);
            print("Ready");
            BASIC.termInput.focus();
        }
    }

    BASIC.orderedLines = function() {
        return Object.keys(BASIC.program).map(t => parseInt(t)).sort((a,b)=>{a<b});
    }

    BASIC.termInput = document.getElementById("term-input");
    BASIC.termOutput = document.getElementById("term-output");
    BASIC.paperStyle = document.getElementById("paper-style");
   
    BASIC.termInput.addEventListener("keyup", function(event) {

        if (event.key === "Enter") BASIC.evalInput(BASIC.termInput.value);
    });

    window.onclick = function() {
       
        BASIC.termInput.focus();
    }

    print("Ready");
    BASIC.termInput.focus();

    </script>
</body>
</html>

... you'd get an interpreter able to take a program like:


10 x = 1
20 gosub 100
30 x = x+1
40 if (x < 20) goto(20)
50 goto 200
100 print x
110 end
200 print "that's all folks"


...as I said, just screwin around.
Thinkbots are free, as in 'free will'

*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
Re: hey
« Reply #6 on: December 11, 2019, 06:56:12 PM »
what the game about?
Thinkbots are free, as in 'free will'

*

Hopefully Something

  • Trusty Member
  • *********
  • Terminator
  • *
  • 780
  • no seriously where are these cookies
Re: hey
« Reply #7 on: December 11, 2019, 07:05:43 PM »
Hey, Zero. 

*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
Re: hey
« Reply #8 on: December 11, 2019, 07:12:16 PM »
Hi Hope ;)

Hey guys, where's Ranch?
Thinkbots are free, as in 'free will'

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6742
  • Mostly Harmless
Re: hey
« Reply #9 on: December 11, 2019, 07:17:25 PM »

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1375
  • Look into my eyes! WOAH!
    • YouTube
Re: hey
« Reply #10 on: December 11, 2019, 09:12:25 PM »
Yo... Z

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

Art

  • At the end of the game, the King and Pawn go into the same box.
  • Global Moderator
  • **********************
  • Colossus
  • *
  • 5659
Re: hey
« Reply #11 on: December 12, 2019, 03:39:16 AM »
Hey Zero! Nice to see you!
In the world of AI, it's the thought that counts!

*

Zero

  • Trusty Member
  • *********
  • Terminator
  • *
  • 855
  • Ready?
    • Thinkbots are free
Re: hey
« Reply #12 on: December 12, 2019, 09:30:06 AM »
Hello friends, it's nice to be back.
Thinkbots are free, as in 'free will'

 


Guest Stream on the VirtualAssistant channel
by 8pla.net (AI in Film and Literature.)
Today at 03:08:43 PM
How Lucid are your thoughts?
by infurl (General AI Discussion)
Today at 09:27:11 AM
Now this is the dream!
by Art (General Robotics Talk)
February 15, 2020, 02:32:41 PM
XKCD Comic : Further Research is Needed
by Tyler (XKCD Comic)
February 15, 2020, 12:00:43 PM
The Heretic
by Zero (Graphics and Video Software)
February 14, 2020, 07:45:41 PM
Friday Funny
by LOCKSUIT (General Chat)
February 14, 2020, 07:43:13 PM
Chatbots DotOrg SOLD?
by squarebear (Virtual Reality)
February 14, 2020, 10:40:42 AM
XKCD Comic : Leap Smearing
by Art (XKCD Comic)
February 13, 2020, 12:03:55 PM

Users Online

11 Guests, 2 Users
Users active in past 15 minutes:
squarebear, ivan.moony
[Trusty Member]

Most Online Today: 25. Most Online Ever: 340 (March 26, 2019, 09:47:57 PM)

Articles