Straight up trivial



  • Guy on reddit asks: How hard is it to make a game in javascript with text based graphics?

    StoneCypher answers: It's straight up trivial

    He then proceeds to write a pretty good roguelike development tutorial. Turns out, it actually is pretty simple to put together a game in js. You can get a lot done just playing with DOM elements.

    But he just can't help himself, and starts including ES6 features... that, of course aren't supported in browsers.

    By post 7, he finally decides to make a "quick detour" and explain how to get his code actually working. Queue a 10.000 word mind-bending dive into setting up a complete javascript build system - node.js, package.json, gulp, browserify, babel, streams... the whole shebang. By the time he was done, the poor OP must have been scratching his head in confusion, wondering where his "trivial" game went.

    Both the best and the worst parts of javascript demonstrated in a single tutorial. I found it amusing.

    Here's the repo with all the code:



  • "Trivial" he says?


  • sockdevs

    .... i love JS, i work in it all the time and even I would hesitate calling what StoneCypher wrote was trivial.

    it started out that way, but then he went off the rails.....


  • Winner of the 2016 Presidential Election

    @cartman82 said:

    It's straight up trivial

    Is that a challenge?

    TwitchTDWTF builds a roguelike in JS, anyone? We can use JSfiddle!

    :trolleybus:


  • Winner of the 2016 Presidential Election

    @Onyx said:

    We can use JSfiddle

    Why not use Discourse based XSS as the development environment?


  • sockdevs

    @Onyx said:

    TDWTF builds a roguelike in JS, anyone?

    nah, we need more of a challenge than that....

    build a rogue like in JS in less than...... 4KB of code INCLUDING any libraries you pull from the web.

    bonus points for writing it in pure ES3.



  • I know gu7zzzz!!!! Why don't just type a number in each post!@?!? LO>LOLOLOLZZZ that's much more fun tyhan vidya gamzess!!!

    Hey6 hy7e hy7e hyeh guyzz!!!...... .... .. ..

    12~~~~~!!!!!


  • sockdevs

    @blakeyrat said:

    I know gu7zzzz!!!! Why don't just type a number in each post!@?!? LO>LOLOLOLZZZ that's much more fun tyhan vidya gamzess!!!

    Hey6 hy7e hy7e hyeh guyzz!!!...... .... .. ..

    12~~~~~!!!!!

    how does that even relate to the discussion at hand?



  • The answer is not in our stars, but in ourselves.


  • sockdevs

    @blakeyrat said:

    The answer is not in our stars, but in ourselves.

    Ah, so you did read The fault in our stars by John Green... Good for you!

    Now how is this germane to the topic at hand?



  • No, I was paraphrasing Shakespeare. Not your shitty "young adult" novel author. You ape.

    "My classical education consisted of reading ALL of the Goosebumps books, THANK YOU VERY MUCH!"


  • sockdevs

    @blakeyrat said:

    You ape.

    Not ape, vulpine, thank you very much.

    You still havent answered me why you are even talking about this in thread instead of using the "Reply as New Topic" button that you get so upset when it isn't used in your threads. I'd like an answer to that please.


  • Discourse touched me in a no-no place

    @blakeyrat said:

    You ape.

    ?



  • @accalia said:

    "Reply as New Topic" button

    Did that get fixed then?



  • @MathNerdCNU said:

    "Trivial" he says?

    You keep on using that line. I do not think it goes how you think it goes.



  • @blakeyrat said:

    I know gu7zzzz!!!! Why don't just type a number in each post!@?!? LO>LOLOLOLZZZ that's much more fun tyhan vidya gamzess!!!

    Hey6 hy7e hy7e hyeh guyzz!!!...... .... .. ..

    12~~~~~!!!!!

    I think he's short circuited. Anyone know the number for Tech Support?


  • sockdevs

    @loopback0 said:

    I think he's short circuited. Anyone know the number for Tech Support?

    you call them. last time i called them to ask for service for our blakeyrat then sent a ninja to my house to assassinate me!

    i was spared only because the ninja couldn't fit inside my burrow by nature of it being fox sized and not human sized.



  • @accalia said:

    you call them.

    If I had the number, I wouldn't be asking.

    @accalia said:

    i was spared only because the ninja couldn't fit inside my burrow by nature of it being fox sized and not human sized.

    They'll send the tiny ninjas next time.

    INB4: the number is 0118 999 881 999 119 725 3


  • sockdevs

    @loopback0 said:

    INB4: the number is 0118 999 881 999 119 725 3

    I was going to tell you the number was 867-5309 actually.


  • Discourse touched me in a no-no place

    @loopback0 said:

    @accalia said:
    you call them.

    If I had the number, I wouldn't be asking.

    ironically it can be gleaned from that counting thread.



  • Psh, it's not that hard. I whipped up this trivial little sort of terminal emulator shell for text-based Javascript I/O... the sample program doesn't really even run the whole gamut of its features:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!--
    
    For a sample program, scroll down (down down down) to function main().
    init() calls main by unshifting [main] onto stack. Other functions can be called similarly.
    To return from a function, shift it off stack. When stack is empty, the program terminates.
    
    Functions that you can call:
    
      breakpoint()
        Sets a breakpoint (for debugging, when debug mode is enabled)
        If debug is enabled and the program is running, an error will be thrown to halt execution
        Code directly below breakpoint() will not be executed (unless the error is caught)
    
      cls()
        Clears the display and moves the cursor to the upper-left corner of the active display viewport
    
      color(fg, bg, border)
        Changes the active foreground, background, and border colours
        The foreground and border may be colours 0-15 from the colour palette
        The background may only be colours 0-7 from the colour palette
    
      input()
        Makes the cursor visible and waits for the user to enter some input
        As characters are entered, they are echoed and the cursor moves
        The cursor wraps around if necessary (the returned string will not have the newline character)
        The active viewport will scroll if necessary to wrap the cursor around to a new line
        If the user has not entered a string yet, nothing will be returned and IP will be decremented to loop there
        After the user enters a value, it is returned as a string
        
        inputbuffer[] can be filtered before calling input() if you wish to (e.g. only allow numbers to be entered)
        To examine what has been entered so far, you can examine the contents of input.buffer
    
      locate(x, y)
        Moves the cursor to position x, y (1-indexed)
        Will not move the cursor outside of the active display viewport
    
      print(s)
        Prints a string to the display at the cursor location in the active foreground and background colours
        The cursor is moved and the viewport will be automatically scrolled if necessary
        By default, control characters (e.g. \t, \n, and some others) are interpreted to modify text output
        To instead print ASCII characters for those codes, set the global variable interpreted_print = false
        Note: output is buffered and will likely not be immediately visible until the background process flushes it
    
      putch(x, y, char, fg, bg)
        Puts char at x, y (0-indexed) using palette colours fg, bg, ignoring viewport, cursor position, and active colours
        Does not interpret control characters; for interpreted print use the print(s) function instead
        Note: output is buffered and will likely not be immediately visible until the background process flushes it
        (Mainly for internal use)
    
      rand(max)
        Returns a random integer which may be any integer from 0 to max - 1, inclusive
        Note: you can use Math.random() instead to obtain a random floating-point number
    
      scroll(from, to, num)
        Scrolls a range of lines (from, to) by a specified number of lines up or down (negative is up, positive is down)
        New blank lines are scrolled onto the active display viewport using the active foreground and background colours
        Lines can be scrolled up to the edge of the active viewport, at which point they are scrolled off it and disappear
        I.e. scroll(2, 3, -1) will scroll lines 2 and 3 up by 1 row, overwriting lines 1 and 2, and 
    
      system(command)
        Executes a system command; the only command supported currently is "pause"
        system("pause") prints "Press any key to continue . . ." and waits for a character in the input buffer
        If there are no characters in the input buffer, it will decrement IP to loop there and return
    
      width(w)
        Clears the display and sets display width to 40 or 80 characters
        Resets the active display viewport
    
    The active display viewport is defined by the global variables vmin, vmax, hmin, hmax
    Most functions will not affect the display outside of the viewport
    
    All I/O is buffered; printed characters will not appear until the background task has flushed the output buffer
    Characters entered by the user are buffered until a function is called which reads them from the input buffer
    
    Functions wait by decrementing IP to loop at the same step until the condition they are waiting for is satisfied
    Typically they are waiting for characters in the input buffer, e.g. system("pause"), input()
    
    The following global variables may be read and/or changed at will:
    
      Integer:
        columnsize (default is 14)
          Sets the column width to align output when a tab character is printed with interpreted print on
        hmin, hmax, vmin, vmax
          Define the active display viewport (0-indexed)
          Note: Do not set these outside the physical screen dimensions (25x80 or 25x40, depending on the width)
    
      Boolean:
        debug
          Enables breakpoint debugging
        interpreted_print (default is true)
          Causes print() to interpret control characters instead of printing them
        selectcolumn (default is true)
          Allows a rectangular column of text to be highlighted instead of typical text area selection
        selectimage
          Allows a rectangular PNG image to be highlighted from the display
        quickedit (default is true)
          Allows selection and right-click to paste with mouse and copy/paste with keyboard
    
      String:
        inputbuffer
          Contains any entered characters which have not yet been read out by the program
          Entered characters are stored as 2-byte sequences (char code, key code)
    
    Debugging:
    
      console, console.log(), etc.
        Brower-default console object providing various logging functions
      watches[]
        An array of names of global variables to watch during single-step debugging
      single_step()
        Execute a single step of the program
        If any watches are defined, this returns a map containing the type and value of each watched variable
      resume()
        Resume execution until the next breakpoint is reached
    
    -->
    <script type="text/javascript"> // define variables to drill-down Javascript errors that prevent it from loading
    var constants_loaded,
      char_opt_loaded,
      disp_maint_loaded,
      print_loaded,
      init_loaded,
      ide_loaded,
      program_loaded;
    var commands = new Array(), executing = false, current_command, current_line, looping;
    </script>
    <script type="text/javascript"> // constants & objects
    console = console || {log: alert};
    
    var hex = "0123456789abcdef";
    function RGB(r, g, b) {
      this.r = r;
      this.g = g;
      this.b = b;
      this.toString = function() {
        return "#" + hex.charAt(Math.floor(this.r/16)) + hex.charAt(this.r%16)
          + hex.charAt(Math.floor(this.g/16)) + hex.charAt(this.g%16)
          + hex.charAt(Math.floor(this.b/16)) + hex.charAt(this.b%16);
      };
    }
    
    function linelimits(y) {
      this.begin = y * hsize + hmin;
      this.end = y * hsize + hmin;
      this.toString = function() {
        return String(Math.pow(10, 3 - Math.floor(Math.log(this.begin > 0 ? this.begin : 1) / Math.log(10)))).substring(1).split("0").join("  ")
          + this.begin + ":  " + (this.end - this.begin);
      };
    }
    
    function ascii(h, foreground, background) {
      var r1 = foreground.r, g1 = foreground.g, b1 = foreground.b;
      var r0 = background.r, g0 = background.g, b0 = background.b;
    
      var base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
      var p = base64.charAt(r1 >> 4) + base64.charAt(((r1 & 15) << 2) | (g1 >> 6)) + base64.charAt(g1 & 63)
        + base64.charAt(b1 >> 2) + base64.charAt(((b1 & 3) << 4) | (r0 >> 4)) + base64.charAt(((r0 & 15) << 2) | (g0 >> 6))
        + base64.charAt(g0 & 63) + base64.charAt(b0 >> 2) + base64.charAt(((b0 & 3) << 4) | 44 >> 4);
    
      if (h <= 12) {
        return "data:image/gif;base64,R0lGODdhAAgMAIAAA" + p + "wAAAAAAAgMAAAC/oyPqcvtDaKMbM6Hs968+w+GIkKN5omm6sq27gvH8owBWknn+s73KR4AVmwLSUZYJG6UBuTQ6Twyh9RDVFHKEq9WY3ALjnq72Om3/DByfautNQi3UebkBBKo9eTP/Ooeb1ZFEph0YwbYBJbosOdHuNgX2bikWKdXCTmYZiE2ZsdpwSY6+rJGWhr6dZFW+LnJ+ZSaqjoVClpxpFmnZTsLcQh8WlNbOcdkqorWGinsCzcICBXmOX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+1XQutV/UMtcwwYHy5z+LHKhbG7+FnpdZ+pxsCjq7nIJW7KepHc/T9XsJdUKVPeCt4TmgNp15Fi6fKb1sl1trX/vedkhxXLA+z1rmQJsTai4i8DEPe8xLaTcxOTjZ8k925DSJjXQMneCFQ6waAUKU/86NsKZjNKI30ji1BJwQZyhbFmC1rHluRGqPt3wJFOs3nr+UqyjtGXZeEEiYb2FIQ+lBnqKjCRrQNE+ClNZGnMxVUQOko3RbUGV7HaqWU42tMsjKHpChaMd63YuU1NfzJ77O/ME4nWlgt4XdTjkHX1XaWdsoVZnhtrPGXRpaJRg8Mph/qw8m9RxK3OIRePc0CjmE5cb+5NffGdmhxk6pHgjLkg/M1zX/uPQiQ2Ts/Yc3FxidNT7vJ8YMSpGOlPt0xl0WqSANqlET1rMdPSzVEWiqstM68CTcgMJXcXNa660xLMa52mBWa/k+qpi7cQxik/MHAOHtmgujidZ6HvfwAWPkpse80E5bdRis4COoxAyb63j2sr+tZCXWveo0V2pY8cb3vRGZ73vzalM49vKQmxGs5dNgyTvW8iosA7B990oeU8b4Qp5ocJ3YtfWOa7Kwg5vgRdeR6Pau5zNHnEyFzk2AEJY2iwmIgyt/VsXHJzhP3g4y1/Ou1icG+Y0r7nNb47zSJzrfOc8T5m59R1kaazcMkAfVdFjMPOe9yDpSm/6V/5z14lTvMPe5e+/NQ5i8t6xnx73MK+wvtORb3XauVMsytvtdKKn/QEFAAA7";
      } else if (h <= 14) {
        return "data:image/gif;base64,R0lGODlhAAgOAIAAA" + p + "wAAAAAAAgOAAAC/oyPqcvtDaKMbM6Hs968+w+GYkKN5omm6sq27gvH8vwAWknn+s73/q+TKHDAohEkJB5bNoPtGXhSkgdltIlQTrGcbVVaAzvF4xu3nLFWzlcS2euAQ8jr9tdt78jznr1VnWUBeLEgKLiEmNjHptgIY8h4deh4YkHZUwIYGKJ56fkJGio6OheJR4qaqjpHksYolObaxaWFlUnXGYuhVitbhkNUazoG60b7evY33FYsebw8OwT9YesUdd2UBMymjJd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aovneIxWlg5uIrf/mOSD7zmV9UCcvx580//vSXQPzno8T6cRe99pfj/HU5lPJhLj2e73f+pv1s82fONBtDX1M3/hOX9GVc7rwwWVLVV//7GeI+/xERfJj0fwOoCf5HgAeIgAm4aAooYNlXgNK3DOEXZ2emLQY4NhLIgM+HgWiSgedFgeEjeekyexGGa6xleW22fvrGeW4kcC2YbfsifC5oYJl3fyY1PlTVgQS4gTnYLLTkaBbIg0EohENIhEVohKDggApnfIgChIaWhEcIhT24g1G4LPKGOlQQXiX4R/Zmet2ngu0nZvCnXDJIf2SWYJh3bz72Us3RhFRIE244fMDng3BIh3Voh3eIh3moh3vIh33oh+dSOl82gkWGhneEb+rHfjF4cGHIZo2Yfp/3ZgEHXsBVg2vIhn+IhG0oCgUAADs=";
      }
    }
    
    constants_loaded = true;
    </script>
    <script type="text/javascript"> // character output
    var font, currentfh, currentfg, currentbg;
    var screenBuffer = undefined, lines, queuedoutput, outputtimeout;
    function putch(x, y, ch, foreground, background) {
      if (typeof(ch) == "string") ch = ch.charCodeAt(0);
      if (typeof(foreground) == "number") foreground = colours[foreground];
      if (typeof(background) == "number") background = colours[background];
    
      if (fontheight != currentfh || foreground != currentfg || background != currentbg) {
        font = new Image();
        font.src = ascii(fontheight, foreground, background);
        currentfh = fontheight;
        currentfg = foreground;
        currentbg = background;
      }
      
      queuedoutput.push({
        x: x,
        y: y,
        ch: ch,
        font: font,
        bg: bg,
        fg: fg
      });
    
      var p = y * hsize + x;
      screenBuffer[0] = screenBuffer[0].substring(0, p) + String.fromCharCode(ch) + screenBuffer[0].substring(p + 1);
      screenBuffer[1] = screenBuffer[1].substring(0, p) + String.fromCharCode(bg << 4 | fg) + screenBuffer[1].substring(p + 1);
    
      if (lines[y].end <= p) {
        p ++;
        lines[y].end = p;
    
        var i = y;
        while (i > 1 && lines[i].begin < lines[i - 1].end) {
          i --;
          lines[i].end = p;
        }
      }
    
      if (queuedoutput[0].font.complete) flush();
      else {
        queuedoutput[0].font.onload = flush;
        outputtimeout = setTimeout("flush();", 0);  // for Opera
      }
    }
    
    function flush() {
      if (outputtimeout) {
        clearTimeout(outputtimeout);
        outputtimeout = 0;
      }
    
      if (!ctx) {
        queuedoutput = new Array();
        outputtimeout = setTimeout("canvas.innerHTML = screentoHTML();", 10);
        
      } else {
        while (queuedoutput.length > 0 && queuedoutput[0].font.complete) {
          var e = queuedoutput.shift();
          ctx.drawImage(e.font, e.ch * charwidth, 0, charwidth, fontheight, e.x * fontwidth, e.y * fontheight, fontwidth, fontheight);
        }
      }
    
      if (queuedoutput.length > 0) {
        queuedoutput[0].font.onload = flush;
      }
    }
    
    function width(n) {
      if (n != 40 && n != 80) return;
      if (n == hsize) return;
      
      var w = hsize * fontwidth;
      hsize = n;
      fontwidth = w / hsize;
      cursor.style.width = fontwidth + "px";
      
      hmin = vmin = 0;
      vmax = vsize - 1;
      hmax = n - 1;
      
      cls();
    }
    
    char_opt_loaded = true;
    </script>
    <script type="text/javascript"> // display maintenance & update
    var oc1, oc2, h1, h2;
    function movecursor() {
      if (arguments.length > 0) cursorvis = arguments[0];
      
      cursor.style.left = (canvas.offsetLeft + borderthickness + (cursorx > hmax ? hmax : cursorx) * fontwidth) + "px";
      cursor.style.top = (canvas.offsetTop + borderthickness + cursory * fontheight) + "px";
    
      if (cur1 != oc1 || cur2 != oc2) {
        if (cur1 < cur2) {
          h1 = cur2;
          h2 = (cur2 > 0 && cur2 < fontheight ? fontheight - cur2 : 0);
        } else if (cur2 < 4) {
          h1 = (cur1 < 4 ? cur1 : fontheight - 2);
          h2 = cur2 - cur1 + 1;
        } else if (cur1 + 3 > cur2) {
          h1 = fontheight - cur2 + cur1 - 2;
          h2 = cur2 - cur1 + 1;
        } else if (cur1 < 3) {
          h1 = cur1;
          h2 = fontheight - cur1;
        } else {
          h1 = fontheight / 2;
          h2 = fontheight / 2;
        }
    
        cursor.style.height = h1 + "px";
      }
      
      cursor.style.borderBottom = "solid " + h2 + "px " + colours[screenBuffer[1].charCodeAt(cursory * hsize + (cursorx > hmax ? hmax : cursorx)) & 15];
      
      cursor.style.display = (cursorvis ? "" : "none");
    }
    
    function blinkcursor() {
      movecursor();
    
      if (cursor.style.visibility == "hidden") cursor.style.visibility = "";
      else cursor.style.visibility = "hidden";
    }
    
    function cls() {
      queuedoutput = [];
      ctx.fillStyle = String(colours[bg]);
      ctx.fillRect(hmin * fontwidth, vmin * fontheight, (hmax - hmin + 1) * fontwidth, (vmax - vmin + 1) * fontheight);
    
      if (!screenBuffer) {
        var l1 = "", l2 = "";
        for (var i = 0; i < hsize; i ++) {
          l1 += " ";
          l2 += String.fromCharCode(bg << 4 | 7);
        }
        screenBuffer = ["", ""];
        lines = [];
        lines.toString = function() { return this.join("\n"); };
        for (var i = 0; i < vsize; i ++) {
          screenBuffer[0] += l1;
          screenBuffer[1] += l2;
          lines[i] = new linelimits(i);
        }
    
      } else {
        var l1 = "", l2 = "";
        for (x = hmin; x <= hmax; x ++) {
          l1 += " ";
          l2 += String.fromCharCode(bg << 4 | 7);
        }
        for (var y = vmin, x, p; y <= vmax; y ++) {
          p = y * hsize + hmin;
          screenBuffer[0] = screenBuffer[0].substring(0, p) + l1 + screenBuffer[0].substring(p + l1.length);
          screenBuffer[1] = screenBuffer[1].substring(0, p) + l2 + screenBuffer[1].substring(p + l2.length);
          lines[y] = new linelimits(y);
        }
      }
    
      cursorx = hmin;
      cursory = vmin;
      movecursor();
    }
    
    function scroll(begin, end, dist) {
      if (begin > end || begin > vmax || end < vmin || dist == 0) return;
    
      while (begin + dist < vmin) begin ++;
      while (end + dist > vmax) end --;
    
      var x = hmin * fontwidth;
      var y1 = begin * fontheight, y2 = y1 + dist * fontheight;
      var w = (hmax - hmin + 1) * fontwidth, h = (end - begin + 1) * fontheight;
      ctx.putImageData(ctx.getImageData(x, y1, w, h), x, y2);
      var y = (dist > 0 ? y1 : y2 + h);
      h = Math.abs(y2 - y1);
      while (y < vmin * fontheight) {
        y += fontheight;
        h -= fontheight;
      }
      while (y + h > (vmax + 1) * fontheight) {
        h -= fontheight;
      }
      ctx.fillStyle = String(colours[bg]);
      if (h > 0) ctx.fillRect(x, y, w, h);
    
      var d = dist / Math.abs(dist), ln;
      var l = new Array("", "");
      for (var x = hmin; x <= hmax; x ++) {
        l[0] += " ";
        l[1] += String.fromCharCode(bg << 4 | fg);
      }
      for (var y = (d > 0 ? end : begin); y + d != (d > 0 ? begin : end); y -= d) if (y + dist >= vmin && y + dist <= vmax) {
        for (var i = 0; i <= 1; i ++) {
          ln = screenBuffer[i].substring(y * hsize + hmin, y * hsize + hmax + 1);
          screenBuffer[i] = screenBuffer[i].substring(0, (y + dist) * hsize + hmin) + ln + screenBuffer[i].substring((y + dist) * hsize + hmin + ln.length);
        }
        lines[y + dist].begin = lines[y].begin + dist * hsize;
        lines[y + dist].end = lines[y].end + dist * hsize;
      }
      for (var y = (d > 0 ? begin : end + dist + 1); y < (d > 0 ? begin + dist : end + 1); y ++) if (y >= vmin && y <= vmax) {
        for (var i = 0; i <= 1; i ++) {
          screenBuffer[i] = screenBuffer[i].substring(0, y * hsize + hmin) + l[i] + screenBuffer[i].substring(y * hsize + hmin + ln.length);
        }
        lines[y].begin = y * hsize;
        lines[y].end = y * hsize;
      }
    }
    
    function locate(v, h) {
      v --;
      h --;
      
      cursorx = Math.round(h);
      if (cursorx > hmax) cursorx = hmax;
      else if (cursorx < hmin) cursorx = hmin;
    
      cursory = Math.round(v);
      if (cursory > vmax) cursory = vmax;
      else if (cursory < vmin) cursory = vmin;
      
      if (arguments.length > 2) cursorvis = (arguments[2] ? true : false);
      if (arguments.length > 4) {
        cur1 = arguments[3];
        cur2 = arguments[4];
      }
    
      movecursor();
    }
    
    function color(f) {
      fg = f % 16;
      if (arguments.length > 1) bg = arguments[1] % 8;
      if (arguments.length > 2) {
        border = arguments[2] % 16;
        canvas.style.borderColor = colours[border];
        canvas.style.background = colours[border];
      }
    }
    
    function screentoHTML() {
      var logical_lines = false;
      if (arguments.length > 0) logical_lines = arguments[1];
    
      var s = new Array();
      var c_fg = false, c_bg = false;
      for (var i = 0; i < vsize; i ++) {
        var o = "", t = "", c = "";
        if (logical_lines) {
          if (i == 0 || lines[i].begin != lines[i - 1].begin) {
            t = screenBuffer[0].substring(lines[i].begin, lines[i].end);
            c = screenBuffer[1].substring(lines[i].begin, lines[i].end);
          }
        } else {
          t = screenBuffer[0].substring(i * hsize, (i + 1) * hsize);
          c = screenBuffer[1].substring(i * hsize, (i + 1) * hsize);
        }
        
        if (t > "") {
          var o = "";
          while (t > "") {
            var ch = t.charAt(0);
    
            if (c_fg === false) {
              c_fg = (c.charCodeAt(0) & 0x0f);
              c_bg = (c.charCodeAt(0) >> 4);
              o += "<nobr><span style=\"color:" + colours[c_fg] + ";background:" + colours[c_bg] + ";" + (ch.charCodeAt(0) > 255 ? "" : "padding-top:2px;padding-bottom:2px;") + "\">";
            } else if (c_fg != (c.charCodeAt(0) & 0x0f) || c_bg != (c.charCodeAt(0) >> 4) || ch.charCodeAt(0) > 255) {
              c_fg = (c.charCodeAt(0) & 0x0f);
              c_bg = (c.charCodeAt(0) >> 4);
              o += "</span><span style=\"color:" + colours[c_fg] + ";background:" + colours[c_bg] + ";" + (ch.charCodeAt(0) > 255 ? "" : "padding-top:2px;padding-bottom:2px;") + "\">";
            }
            
            if (ch == " " || ch == "\377") ch = "&nbsp;";
            else if (ch == "<") ch = "&lt;";
            
            o += ch;
            t = t.substring(1);
            c = c.substring(1);
          }
          s.push(o);
        }
      }
      
      return(s.join("<br/>") + "</span></nobr>");
    }
    
    disp_maint_loaded = true;
    </script>
    <script type="text/javascript"> // printing text
    var interpreted_print = true;
    function print(text) {
      if (typeof(text) != "string") text = String(text);
      print.value = text;
    
      cursor.style.display = "none";
      for (var i = 0, ch; i < text.length; i ++) {
        if (interpreted_print) ch = text.charCodeAt(i);
        else ch = 0;
    
        switch (ch) {
        case 7:
          // bell character
          break;
        case 9:
          // tab character
          var newx = (Math.floor(cursorx / columnsize) + 1) * columnsize;
          if (newx + columnsize < hmax) {
            while (cursorx < newx) {
              putch(cursorx, cursory, " ", fg, bg);
              cursorx ++;
            }
            
          } else {
            cursorx = hmin;
            cursory ++;
            
            if (cursory > vmax) {
              scroll(vmin + 1, vmax, -1);
              cursory = vmax;
            }
          }
          break;
        case 10:
        case 13:
          cursorx = hmin;
          cursory ++;
          break;
        case 11:
          cursorx = hmin;
          cursory = vmin;
          break;
        case 12:
          cls();
          break;
        case 28:
          cursorx ++;
          break;
        case 29:
          if (cursorx > hmin) cursorx --;
          break;
        case 30:
          if (cursory > vmin) cursory --;
          break;
        case 31:
          if (cursory < vmax) cursory ++;
          break;
    
        default:
          if (cursorx > hmax) {
            cursorx = hmin;
            cursory ++;
          }
          if (cursory > vmax) {
            scroll(vmin + 1, vmax, -1);
            cursory = vmax;
          }
          putch(cursorx, cursory, text.charAt(i), fg, bg);
          cursorx ++;
        }
    
        if (cursorx > hmax + 1) {
          cursorx = hmin;
          cursory ++;
        }
        if (cursory > vmax) {
          scroll(vmin + 1, vmax, -1);
          cursory = vmax;
        }
      }
    
      movecursor();
    }
    print_loaded = true;
    </script>
    

    Body is limited to 32000 characters; you entered 51624.

    (1/2)



  • <script type="text/javascript"> // IDE
    var inputbuffer = "";
    function trapkey(ch, kc) {
      if (selection !== false) {
        if (selectcolumn || selectimage) {
          var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
          var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
          invert(x1, y1, x2, y2);
          if (document.getElementById("imgclipboard").style.visibility != "hidden") document.getElementById("imgclipboard").style.visibility = "hidden";
          
        } else {
          var x1 = selection.x1, x2 = selection.x2, y1 = selection.y1, y2 = selection.y2;
          if (x1 > x2) {
            x1 = selection.x2;
            y1 = selection.y2;
            x2 = selection.x1;
            y2 = selection.y1;
          }
          if (x1 == x2) {
            invert(x1, Math.min(y1, y2), x2, Math.max(y1, y2));
          } else {
            invert(x1, y1, x1, 79);
            if (x2 - x1 > 1) invert(x1 + 1, 0, x2 - 1, 79);
            invert(x2, 0, x2, y2);
          }
        }
        movecursor(selection.cv);
    
        selection = false;
        return true;
      }
    
      var e = false;
      if (arguments.length > 2) {
        e = arguments[2];
        if (ch == undefined) ch = e.which;
        if (ch < 32) ch = 0;
      }
    
      if (e.ctrlKey && (ch == 86 || ch == 118)) { // ctrl-v
        document.getElementById("clipboard").focus();
        document.getElementById("clipboard").select();
        var t = setTimeout("paste();", 0);
        return true;
      } else if (e.ctrlKey && (ch == 67 || ch == 99)) { // ctrl-c
        if (confirm("Confirm ^C?") !== true) return;
        print("^C\n");
        print("Break \n");
        if (inputbuffer > "") inputbuffer = "";
        if (pastebuffer > "") pastebuffer = "";
        if (executing !== false) {
          breakpoint();
          executing = clearTimeout(executing);
        }
        return false;
      }
      
      inputbuffer += String.fromCharCode(ch, kc);
    
      if (kc == 122 || kc == 123) return true;
      return false;
    }
    
    var selection = false;
    function mouseDown(e) {
      if (e.button == 2 || canvas.onmousemove != null) return false;
    
      if (selectcolumn && selectimage) selectcolumn = false;
    
      var x = e.clientY - canvas.offsetTop - Number(String(canvas.style.borderTopWidth).split("px").join(""));
      var y = e.clientX - canvas.offsetLeft - Number(String(canvas.style.borderLeftWidth).split("px").join(""));
      if (!selectimage) {
        x = Math.floor(x / fontheight);
        y = Math.floor(y / fontwidth);
        if (x >= vsize) x = vsize - 1;
        else if (x < 0) x = 0;
        if (y >= hsize) y = hsize - 1;
        else if (y < 0) y = 0;
      } else {
        if (x >= vsize * fontheight) x = vsize * fontheight - 1;
        else if (x < 0) x = 0;
        if (y >= hsize * fontwidth) y = hsize * fontwidth - 1;
        else if (y < 0) y = 0;
      }
    
      if (quickedit) {
        if (selection !== false) {
          // erase old selection
          if (selectcolumn || selectimage) {
            var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
            var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
            invert(x1, y1, x2, y2);
            if (document.getElementById("imgclipboard").style.visibility != "hidden") document.getElementById("imgclipboard").style.visibility = "hidden";
            
          } else {
            var x1 = selection.x1, x2 = selection.x2, y1 = selection.y1, y2 = selection.y2;
            if (x1 > x2) {
              x1 = selection.x2;
              y1 = selection.y2;
              x2 = selection.x1;
              y2 = selection.y1;
            }
            if (x1 == x2) {
              invert(x1, Math.min(y1, y2), x2, Math.max(y1, y2));
            } else {
              invert(x1, y1, x1, 79);
              if (x2 - x1 > 1) invert(x1 + 1, 0, x2 - 1, 79);
              invert(x2, 0, x2, y2);
            }
          }
        }
        
        if (e.button != 0) {
          selection = false;
          return;
        }
    
        selection = {x1: x, x2: x, y1: y, y2: y, cv: cursorvis};
        //selection.x1 = selection.x2 = x;
        //selection.y1 = selection.y2 = y;
        
        // draw selection
        if (selectcolumn || selectimage) {
          var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
          var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
          invert(x1, y1, x2, y2);
        } else {
          var x1 = selection.x1, x2 = selection.x2, y1 = selection.y1, y2 = selection.y2;
          if (x1 > x2) {
            x1 = selection.x2;
            y1 = selection.y2;
            x2 = selection.x1;
            y2 = selection.y1;
          }
          if (x1 == x2) {
            invert(x1, Math.min(y1, y2), x2, Math.max(y1, y2));
          } else {
            invert(x1, y1, x1, 79);
            if (x2 - x1 > 1) invert(x1 + 1, 0, x2 - 1, 79);
            invert(x2, 0, x2, y2);
          }
        }
        
        canvas.onmousemove = mouseMove;
        
        movecursor(false);
      }
    }
    
    function mouseMove(e) {
      if (selection === false) return canvas.onmousemove = null;
      
      var x = e.clientY - canvas.offsetTop - Number(String(canvas.style.borderTopWidth).split("px").join(""));
      var y = e.clientX - canvas.offsetLeft - Number(String(canvas.style.borderLeftWidth).split("px").join(""));
      if (!selectimage) {
        x = Math.floor(x / fontheight);
        y = Math.floor(y / fontwidth);
        if (x >= vsize) x = vsize - 1;
        else if (x < 0) x = 0;
        if (y >= hsize) y = hsize - 1;
        else if (y < 0) y = 0;
      } else {
        if (x >= vsize * fontheight) x = vsize * fontheight - 1;
        else if (x < 0) x = 0;
        if (y >= hsize * fontwidth) y = hsize * fontwidth - 1;
        else if (y < 0) y = 0;
      }
    
      if (selection.x2 !== false) {
        // erase old selection
        if (selectcolumn || selectimage) {
          var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
          var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
          invert(x1, y1, x2, y2);
        } else {
          var x1 = selection.x1, x2 = selection.x2, y1 = selection.y1, y2 = selection.y2;
          if (x1 > x2) {
            x1 = selection.x2;
            y1 = selection.y2;
            x2 = selection.x1;
            y2 = selection.y1;
          }
          if (x1 == x2) {
            invert(x1, Math.min(y1, y2), x2, Math.max(y1, y2));
          } else {
            invert(x1, y1, x1, 79);
            if (x2 - x1 > 1) invert(x1 + 1, 0, x2 - 1, 79);
            invert(x2, 0, x2, y2);
          }
        }
      }
      
      selection.x2 = x;
      selection.y2 = y;
      
      // draw new selection
      if (selectcolumn || selectimage) {
        var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
        var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
        invert(x1, y1, x2, y2);
      } else {
        var x1 = selection.x1, x2 = selection.x2, y1 = selection.y1, y2 = selection.y2;
        if (x1 > x2) {
          x1 = selection.x2;
          y1 = selection.y2;
          x2 = selection.x1;
          y2 = selection.y1;
        }
        if (x1 == x2) {
          invert(x1, Math.min(y1, y2), x2, Math.max(y1, y2));
        } else {
          invert(x1, y1, x1, 79);
          if (x2 - x1 > 1) invert(x1 + 1, 0, x2 - 1, 79);
          invert(x2, 0, x2, y2);
        }
      }
    }
    
    function invert(x1, y1, x2, y2) {
      if (!selectimage) {
        x1 = x1 * fontheight;
        y1 = y1 * fontwidth;
        x2 = (x2 + 1) * fontheight;
        y2 = (y2 + 1) * fontwidth;
      } else {
        x2 += 1;
        y2 += 1;
      }
      
      var img = ctx.getImageData(y1, x1, y2 - y1, x2 - x1);
      for (var i = 0; i < img.data.length; i += 4) {
        img.data[i] = 255 - img.data[i];
        img.data[i + 1] = 255 - img.data[i + 1];
        img.data[i + 2] = 255 - img.data[i + 2];
      }
      ctx.putImageData(img, y1, x1);
    }
    
    function mouseUp(e) {
      if (quickedit && selection !== false) {
        canvas.onmousemove = null;
        
        var s = [], x, y, i;
        if (selectimage) {
          //image selection
          var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2) + 1;
          var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2) + 1;
          var c = document.createElement("canvas");
          c.height = x2 - x1;
          c.width = y2 - y1;
          
          var ctx2 = c.getContext("2d");
          var img = ctx.getImageData(y1, x1, y2 - y1, x2 - x1);
          for (var i = 0; i < img.data.length; i += 4) {
            img.data[i] = 255 - img.data[i];
            img.data[i + 1] = 255 - img.data[i + 1];
            img.data[i + 2] = 255 - img.data[i + 2];
          }
          ctx2.putImageData(img, 0, 0);
          
          img = c.toDataURL();
          //image copy is broken, best we can do is open new window and they can right-click and Copy Image
          //window.open(img);
          var imgclipboard = document.getElementById("imgclipboard");
          imgclipboard.src = img;
          imgclipboard.style.top = String(canvas.offsetTop + Number(String(canvas.style.borderTopWidth).split("px").join("")) + x1) + "px";
          imgclipboard.style.left = String(canvas.offsetLeft + Number(String(canvas.style.borderLeftWidth).split("px").join("")) + y1) + "px";
          imgclipboard.style.visibility = "";
          
    //      window.getSelection().selectAllChildren(document.body);
          var strongs = document.getElementsByTagName("img");
          var s = window.getSelection();
          if (s.rangeCount > 0) s.removeAllRanges();
          for (var i = 0; i < strongs.length; i++) {
            var range = document.createRange();
            range.selectNode(strongs[i]);
            s.addRange(range);
          }
          
        } else if (selectcolumn) {
          var x1 = Math.min(selection.x1, selection.x2), x2 = Math.max(selection.x1, selection.x2);
          var y1 = Math.min(selection.y1, selection.y2), y2 = Math.max(selection.y1, selection.y2);
          for (x = x1; x <= x2; x ++) {
            i = s.length;
            s[i] = screenBuffer[0].substring(x * hsize + y1, x * hsize + y2 + 1);
            while (s[i].charAt(s[i].length - 1) == " ") s[i] = s[i].substring(0, s[i].length - 1);
          }
        } else {
          var x1 = selection.x1, y1 = selection.y1, x2 = selection.x2, y2 = selection.y2;
          if (x1 > x2) {
            x1 = selection.x2;
            y1 = selection.y2;
            x2 = selection.x1;
            y2 = selection.y1;
          } else if (x1 == x2) {
            y1 = Math.min(selection.y1, selection.y2);
            y2 = Math.max(selection.y1, selection.y2);
          }
          for (x = x1; x <= x2; x ++) {
            i = s.length;
            s[i] = screenBuffer[0].substring(x * hsize + (x == x1 ? y1 : 0), x * hsize + (x == x2 ? y2 : 79) + 1);
            while (s[i].charAt(s[i].length - 1) == " ") s[i] = s[i].substring(0, s[i].length - 1);
          }
        }
        document.getElementById("clipboard").value = s.join("\n");
        document.getElementById("clipboard").focus();
        document.getElementById("clipboard").select();
      }
    }
    
    var pastebuffer = "";
    function paste() {
      var c = document.getElementById("clipboard").value;
      document.getElementById("clipboard").value = "";
      document.getElementById("clipboard").blur();
      
      for (var i = 0; i < c.length; i ++) inputbuffer += String.fromCharCode(c.charCodeAt(i), 0);
    }
    
    function system(syscmd) {
      switch (String(syscmd).toLowerCase()) {
        case "pause":
          if (typeof system.pause == "undefined") system.pause = false;
          if (!system.pause) {
            print("Press any key to continue . . .");
            system.pause = true;
            system.cursorvis = cursorvis;
            movecursor(true);
          }
          if (inputbuffer.length > 0) {
            inputbuffer = inputbuffer.substr(2);
            system.pause = false;
            movecursor(system.cursorvis);
          } else {
            IP --;  //loop until character entered
          }
          break;
        default:
          print("Unrecognised system command: " + syscmd + "\n");
      }
    }
    system.pause = false;
    
    function input() {
      if (!input.waiting) {
        input.cursorvis = cursorvis;
        movecursor(true);
        input.waiting = true;
      }
    
      while (inputbuffer.length > 0) {
        if (inputbuffer.charAt(0) == "\0") {
          var c = inputbuffer.charAt(1);
          switch (c) {
          case "\b":
            if (input.buffer.length > 0 && input.buffer.charAt(input.buffer.length - 1) != "\n") {
              input.buffer = input.buffer.substr(0, input.buffer.length - 1);
              cursorx --;
              if (cursorx < hmin) {
                cursorx = hmax;
                cursory --;
              }
              var ocx = cursorx, ocy = cursory;
              print(" ");
              cursorx = ocx;
              cursory = ocy;
              movecursor();
            }
            break;
          case "\r":
            input.buffer += "\n";
            print("\n");
            break;
          case "\x1B":  // esc
            while (input.buffer.length > 0 && input.buffer.charAt(input.buffer.length - 1) != "\n") {
              input.buffer = input.buffer.substr(0, input.buffer.length - 1);
              cursorx --;
              if (cursorx < hmin) {
                cursorx = hmax;
                cursory --;
              }
              var ocx = cursorx, ocy = cursory;
              print(" ");
              cursorx = ocx;
              cursory = ocy;
            }
            movecursor();
          }
        } else {
          var ch = inputbuffer.charAt(0);
          if (cursorx > hmax) {
            if (cursory == vmax) {
              scroll(vmin + 1, vmax, -1);
              cursory --;
            }
            scroll(cursory + 1, vmax - 1, 1);
            lines[cursory].end = lines[cursory + 1].end;
            lines[cursory + 1].begin = lines[cursory].begin;
          }
          print(ch);
          input.buffer += ch;
        }
        inputbuffer = inputbuffer.substr(2);
      }
      if (input.buffer.indexOf("\n") >= 0) {
        var output = input.buffer.substr(0, input.buffer.indexOf("\n"));
        input.buffer = input.buffer.substr(input.buffer.indexOf("\n") + 1);
        movecursor(input.cursorvis);
        input.waiting = false;
        return output;
      } else {
        IP --;  // loop until enough data
        return false;
      }
    }
    input.waiting = false;
    input.buffer = "";
    
    function rand(RAND_MAX) {
      return Math.floor(Math.random() * RAND_MAX);
    }
    
    var stack = [], CS, IP;
    function resume() {
      if (stack.length == 0) return;
      var priorlen = stack.length;
      CS = stack[0][0];
      IP = stack[0][1] || 0;
      if (CS) CS();
      else {
        alert("Function to execute is not defined");
        stack.unshift();
      }
      if (stack.length >= priorlen) {
        stack[stack.length - priorlen][1] = IP + 1;
      }
      if (stack.length > 0) {
        executing = setTimeout(resume, system.pause || input.waiting ? 100 : 0);
      } else {
        console.log("Program terminated");
        movecursor(false);
      }
    }
    
    var debug = false;
    function breakpoint() {
      console.log(" -- Breakpoint: Function " + stack[0][0].name + ", step " + stack[0][1]);
      if (Array.isArray(watches) && watches.length > 0) {
        for (var i = 0; i < watches.length; i ++) {
          for (var o = window, p = watches[i]; p.indexOf(".") >= 0; p = p.substring(p.indexOf(".") + 1))
            o = o.hasOwnProperty(p.substring(0, p.indexOf("."))) ? o[p.substring(0, p.indexOf("."))] : {};
          var v = o.hasOwnProperty(p) ? o[p] : undefined;
          console.log({name: watches[i], type: typeof v, value: v});
        }
      }
      if (executing !== false && debug) {
        clearTimeout(executing);
        executing = false;
        throw "Stop";
      }
    }
    
    var watches = [];
    function single_step() {
      if (stack.length == 0) return;
      
      if (executing !== false) {
        try {
          breakpoint();
        } catch (e) {
          console.error(e);
        }
      }
      
      console.log("Stepping into: Function " + stack[0][0].name + ", step " + stack[0][1]);
      var priorlen = stack.length;
      CS = stack[0][0];
      IP = stack[0][1] || 0;
      if (CS) CS();
      else {
        alert("Function to execute is not defined");
        stack.unshift();
      }
      if (stack.length >= priorlen) {
        stack[stack.length - priorlen][1] = IP + 1;
      }
      console.log("Next step: Function " + stack[0][0].name + ", step " + stack[0][1]);
      if (Array.isArray(watches) && watches.length > 0) {
        var ret = [];
        for (var i = 0; i < watches.length; i ++) {
          for (var o = window, p = watches[i]; p.indexOf(".") >= 0; p = p.substring(p.indexOf(".") + 1))
            o = o.hasOwnProperty(p.substring(0, p.indexOf("."))) ? o[p.substring(0, p.indexOf("."))] : {};
          var v = o.hasOwnProperty(p) ? o[p] : undefined;
          ret.push({name: watches[i], type: typeof v, value: v});
        }
        return ret;
      }
      if (stack.length == 0) {
        cursorvis = false;
        movecursor();
        window.onkeypress = null;
        document.body.onkeydown = null;
        document.body.onkeypress = null;
      }
    }
    
    ide_loaded = true;
    </script>
    <script type="text/javascript"> // setup & initialization
    var colours = [new RGB(0,0,0), new RGB(0,0,168), new RGB(0,168,0), new RGB(0,168,168), new RGB(168,0,0),
      new RGB(168,0,168), new RGB(168,84,0), new RGB(168,168,168), new RGB(84,84,84), new RGB(84,84,252),
      new RGB(84,252,84), new RGB(84,252,252), new RGB(252,84,84), new RGB(252,84,252), new RGB(252,252,84),
      new RGB(252,252,252)];
    var hsize = 80, vsize = 25, charwidth = 8, fontwidth = 8, fontheight = 16;
    var columnsize = 14;
    var borderthickness = 8;
    var fg, bg, border;
    var hmin, hmax, vmin, vmax;
    var cursorx, cursory;
    var cursorvis, cur1, cur2;
    var quickedit = true, selectcolumn = true, selectimage = false;
    
    var canvas, ctx, cursorblink, cursor, browser, urlParams;
    function init() {
      if (!(constants_loaded && char_opt_loaded && disp_maint_loaded && print_loaded && ide_loaded)) document.body.onkeypress = "";
      if (!constants_loaded) return alert("Error loading constants");
      if (!char_opt_loaded) return alert("Error loading character output routines");
      if (!disp_maint_loaded) return alert("Error loading display maintenance routines");
      if (!print_loaded) return alert("Error loading print routines");
      if (!ide_loaded) return alert("Error loading IDE routines");
    
      if (/Firefox/.test(navigator.userAgent)) {
        window.onkeypress = function (event) {
          return trapkey(event.charCode, (event.charCode ? (event.ctrlKey * 17) | (event.altKey * 18) : event.keyCode), event);
        };
      } else {
        document.body.onkeydown = function () {
          var kc = event.keyCode;
          if ((event.ctrlKey || event.altKey) && kc >= 65 && kc <= 90) {
            trapkey(kc, 0, event);
            return false;
          }
          
          if (kc == 8 || kc == 9 || kc == 13 || (kc >= 33 && kc <= 40) || (kc >= 45 && kc <= 46) || (kc >= 112 && kc <= 121)) {
            trapkey(0, kc, event);
            return false;
          }
          
          return true;
        };
        document.body.onkeypress = function() { return trapkey(event.keyCode, 0, event); };
      }
    
      canvas = document.getElementById("canvas");
      cursor = document.getElementById("cursor");
      try {
        // attempt to use canvas, and create a hacked text mode for unsupported browsers using a pre element instead
        ctx = canvas.getContext("2d");
        
      } catch (e) {
        var p = document.createElement("div");
        p.style.display = "inline-block";
        p.style.width = "0";
        p.style.color = String(colours[7]);
        p.style.fontFamily = "Terminal";
        p.style.fontSize = "10pt";
        p.style.lineHeight = fontheight + "px";
        canvas.parentNode.insertBefore(p, canvas.nextSibling);
        canvas = p;
        
        cursor.style.lineHeight = "8px";
        
        ctx = new Object();
        ctx.fillRect = function() { outputtimeout = setTimeout("flush();", 1); };
        ctx.drawImage = function() { outputtimeout = setTimeout("flush();", 1); };
        ctx.getImageData = function() {};
        ctx.putImageData = function() { outputtimeout = setTimeout("flush();", 1); };
      }
    
      canvas.style.borderStyle = "solid";
      canvas.style.borderWidth = borderthickness + "px";
      canvas.width = hsize * fontwidth;
      canvas.height = vsize * fontheight;
      ctx.mozImageSmoothingEnabled = false;
    
      if (outputtimeout) clearTimeout(outputtimeout);
      outputtimeout = false;
      if (executing) clearTimeout(executing);
      executing = false;
      if (cursorblink) clearInterval(cursorblink);
      color(7, 0, 0);
      hmin = vmin = 0;
      hmax = hsize - 1;
      vmax = vsize - 1;
      cursorvis = false;
      cur1 = cur2 = 7;
      cls();
    
      cursor.style.width = fontwidth + "px";
      cursor.style.visibility = "hidden";
      cursorblink = setInterval("blinkcursor();", 1000 * (4 / 15));
    
      document.title = "";
      
      if (!program_loaded) alert("Error loading program, this might not work...");
      stack.unshift([main]); // load main() on the resume stack with a local Instruction Pointer of 0
      executing = setTimeout("resume();", 0);
    }
    
    init_loaded = true;
    </script>
    <script> // main()
    function main() {
    switch (IP) {
    case 0://dim primes(20)
      main.primes = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
      stack.unshift([greet]);
      break;
    case 1://found = 0
      print("Do you like prime numbers? Don't answer that; it's rhetorical.\n");
      print("Here are some prime numbers:\n");
      main.found = 0;
      break;
    case 2://i = 2
      main.i = 2;
      break;
    case 3://while found < 20
      if (!(main.found < 20)) IP = 14;
      break;
    case 4://n = 0
      main.n = 0;
      break;
    case 5://for p = 1 to found
      if ((main.p = 1) > main.found) IP = 7;
      break;
    case 6://if i/primes(p) = int(i/primes(p)) n = n + 1
      if (main.i/main.primes[main.p] == Math.floor(main.i/main.primes[main.p])) main.n ++;
      break;
    case 7://next p
      main.p ++;
      if (main.p <= main.found) IP = 5;
      break;
    case 8://if n = 0 then
      if (!(main.n == 0)) IP = 12;
      break;
    case 9://found = found + 1
      main.found ++;
      break;
    case 10://print i
      print(main.i + "\t");
      break;
    case 11://primes(found) = i
      main.primes[main.found] = main.i;
      break;
    case 12://end if
      break;
    case 13://i = i + 1
      main.i += 1;
      break;
    case 14://end while
      if (main.found < 20) IP = 3;
      break;
    case 15://print and flush the input buffer
      print("\n");
      if (inputbuffer) {
        print("There were " + inputbuffer.length / 2 + " chars in the input buffer: " + inputbuffer + "\n");
        inputbuffer = "";
      }
      break;
    case 16://wait for a keypress
      system("pause");
      break;
    default://end
      print("\nZZzzzzzzzz");
      stack.shift();  // remove the main() stack frame to halt program resume
    }
    }
    
    function greet() {
    switch (IP) {
    case 0:
      print("Hello! Please enter some text: ");
      break;
    case 1:
      greet.txt = input();
      break;
    case 2:
      print("You entered: " + greet.txt + "\n\n");
      break;
    default:
      breakpoint();
      stack.shift();
    }
    }
    
    watches.push("greet.txt");
    
    program_loaded = true;
    </script>
    </head>
    
    <body onload="if (!init_loaded) { window.onkeypress = ''; alert('Error loading initialization routines'); } else init();">
    <div id="cursor" style="position:absolute;"></div>
    <canvas id="canvas" width="640" height="400" onmousedown="return mouseDown(event);" onmouseup="return mouseUp(event);"></canvas><br/>
    <textarea id="clipboard" style="height:0px;width:0px;top:-10px;position:absolute;"></textarea>
    <img style="visibility:hidden;position:absolute;cursor:move;" title="Right-click and select Copy Image. Press Esc to clear selection." id="imgclipboard"/>
    </body>
    </html>
    

    (2/2)



  • By default, it also allows rectangular text selection with the mouse, and Ctrl-C/V copy and paste:

    There's also the option to turn selectcolumn off, which results in free-form text selection:

    Or to turn selectimage on, which allows rectangular image selection:

    (note: don't change those while something is selected, or the highlighted area probably won't go back to normal correctly)



  • Did anybody ask?

    I sure as fuck didn't.



  • An opinion that I sure as fuck didn't ask for? Sounds like a personal problem.



  • The... Fault? In our stars?

    @blakeyrat said:

    No, I was paraphrasing Shakespeare.

    Answer: No :hanzo:



  • If he's an ape, there's hope for every prince.

    Filed Under: I did not have sexual relations with that dolphinDauphin.





  • @ScholRLEA said:

    I did not have sexual relations with that dolphin

    Why not? Do you have something against dolphins? Are you specieist?


  • Winner of the 2016 Presidential Election

    @PleegWat said:

    Why not?

    It was not good enough for his porpoises.


  • sockdevs

    @PleegWat said:

    Do you have something against dolphins?

    Yes, they never return my calls.


  • mod

    That's because the dolphins are all phonies; they seem nice enough at first, they pretend to be your friend, until they see you at your worst and then they leave you -- without a word, they swim away.

    <!-- lyrics from JoCo's "I crush everything" -->

  • Winner of the 2016 Presidential Election

    You obviously didn't offer them enough fish. They tend to thank you for that before leaving



  • @loopback0 said:

    Anyone know the number for Tech Support?

    Yes, but we have to type it one number at a time in different replies.

    9



  • [quote=Richard Feynman]
    Then I got an idea. I challenged them: "I bet there isn't a single theorem that you can tell me - what the assumptions are and what the theorem is in terms I can understand - where I can't tell you right away whether it's true or false."

    It often went like this: They would explain to me, "You've got an orange, OK? Now you cut the orange into a finite number of pieces, put it back together, and it's as big as the sun. True or false?"

    "No holes."

    "Impossible!"

    "Ha! Everybody gather around! It's So-and-so's theorem of immeasurable measure!"

    Just when they think they've got me, I remind them, "But you said an orange! You can't cut the orange peel any thinner than the atoms."

    "But we have the condition of continuity: We can keep on cutting!"

    "No, you said an orange, so I assumed that you meant a real orange."

    So I always won. If I guessed it right, great. If I guessed it wrong,
    there was always something I could find in their simplification that they left out.
    [/quote]

    [poll name=simple]

    • The math grad students were being sloppy
    • Dick was being a dick by rules-lawyering because he couldn't stand to lose
    • E_FEYNMAN_NOT_FOUND
      [/poll]


  • This post is deleted!


  • Quite some maths simplifications don't apply to the real world.



  • For this theorem, we will assume that people are perfect spheres of radius N.



  • Good grief, couldn't you just have attached the file?

    anotherusername's blob of code.html (51.4 KB)



  • Whoa, you can do that? Ok...

    But, it's an additional barrier to scrolling through the code and going :wtf:...

    Which admittedly the code is...

    Especially when you look at main()...



  • Wow. Indeed.

    And that ascii function.



  • The ascii function has a heaping helping of cleverness, I admit. The base64-wrangling injects the desired RGB values into the raw, base64-encoded .gif file's palette entries.

    Now, take a look at greet (right below main) and see how input works...


  • Winner of the 2016 Presidential Election

    I'm assuming the jellypotato every time this thread is opened is down to that code dump



  • It's probably when it syntax-highlights the whole thing.



  • @ben_lubar said:

    > For this theorem, we will assume that people are perfect spheres of radius N.

    ... in vacuum, please. Nobody wants to deal with an atmosphere, which involves a lot of complicated fluid dynamics.



  • @cvi said:

    in vacuum, please

    Well, it does bring you closer to being a perfect sphere...


    Filed under: disclaimer: 1990s Schwarzenegger movies are not a reliable description of physics. please do not try this at home


  • Winner of the 2016 Presidential Election

    @accalia said:

    867-5309naaaayiyaiyan

    FTFY


  • sockdevs

    @sloosecannon said:

    @accalia said:
    867-5309naaaayiyaiyan

    FTFY

    what about +1 (207) 775-4321?

    (that one is safe to call, i promise it's not the FBI like the last time i posted an actual phone number)


  • Winner of the 2016 Presidential Election

    Whose number is that? Googling indicates nothing particularly interesting.


  • sockdevs

    @sloosecannon said:

    Whose number is that? Googling indicates nothing particularly interesting.

    call it and find out.

    :imp:

    [spoiler]Apropos of nothing, you know the London Speaking Clock? We have one too![/spoiler]


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.