hey

  • 12 Replies
  • 2689 Views
*

Zero

  • Eve
  • ***********
  • 1287
hey
« on: December 11, 2019, 05:19:47 pm »
hi guys
I'm back

*

Freddy

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

*

Zero

  • Eve
  • ***********
  • 1287
Re: hey
« Reply #2 on: December 11, 2019, 05:50:25 pm »
How are you Freddy? :)

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: hey
« Reply #3 on: December 11, 2019, 06:09:42 pm »
Hi  :)

Long time no see...

Are there any cool projects?

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • 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

  • Eve
  • ***********
  • 1287
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
<!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.

*

Zero

  • Eve
  • ***********
  • 1287
Re: hey
« Reply #6 on: December 11, 2019, 06:56:12 pm »
what the game about?

*

HS

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1178
Re: hey
« Reply #7 on: December 11, 2019, 07:05:43 pm »
Hey, Zero. 

*

Zero

  • Eve
  • ***********
  • 1287
Re: hey
« Reply #8 on: December 11, 2019, 07:12:16 pm »
Hi Hope ;)

Hey guys, where's Ranch?

*

Freddy

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

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • 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.
  • Moderator
  • **********************
  • Colossus
  • *
  • 5865
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

  • Eve
  • ***********
  • 1287
Re: hey
« Reply #12 on: December 12, 2019, 09:30:06 am »
Hello friends, it's nice to be back.

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

388 Guests, 0 Users

Most Online Today: 532. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles