Skip to main content

News

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Radnen

1
Programming / Re: So I wrote a monad tutorial...
@FatCerberus: I think you just nailed it with that post, bud. :) That's indeed the simplest explanation yet. I was looking for a simple overview, like an "all-together", and what you just wrote, is it.
2
Programming / Re: So I wrote a monad tutorial...
I'm only loosely aware of monads and in theory know what they are. Like I knew that a JS Promise is a monad-like structure, but not exactly as to why.

I'd say I understand Monads a bit better from an imperative context, but I also think your tutorial isn't necessarily the easiest to understand. I think if one has a lot of programming experience, one can follow along, but at the very end of the day monads are complex, and must take a complex chain of thought to understand. And, if anything, actually making a monad and playing around with them interactively is the best way to learn.

But as for me, I will definitely say I came out learning a lot more about them. So, I do think it's effective for more seasoned programmers, Does it break the curse? I dunno, but I'm sure you'll find out someday!
3
This is looking really sweet and I"m very happy to see how far Sphere has come with it's new JS and graphics engines. Keep it up! I might even get back into game dev with Sphere again. My girlfriend wants to work on a game with me, haha.
4
Hellos and Byes / Re: Happy 2019!
Hi FBNil! Long time no see! I hope you have a fantabulous 2019 too! :)
5
I'm still baffled the widespread popularity of lodash... when libraries you and I write can be an order of magnitude faster, and any missing convenience methods lodash has, can always be added.

Anyways, I didn't have from.js on me, but I ran your parameters on my new Linkier library along with lazy and Link and got:
Code: ('js') [Select]
const Linkier = require('./linkier.js');
const Link = require('./modules/link.js');
const Lazy = require('./modules/lazy.js');
const Benchmark = require('benchmark');

// Generate a random list of 100,000 integer between 0 and 1,000.
const items = [];
for (let i = 0; i < 100000; ++i) {
    items[i] = Math.floor(Math.random() * 1001);
}

const suite = new Benchmark.Suite;
const linkier = Linkier(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);
const link = Link(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);
const lazy = Lazy(items).filter(n => n % 2 === 0).take(10000).map(n => n + 1);

suite.add('Linkier', function() {
    linkier.reduce((a, n) => a + n, 0);
}).add('Link', function() {
    link.reduce((a, n) => a + n, 0);
}).add('Lazy', function() {
    lazy.reduce((a, n) => a + n, 0);
}).add('For Loop', function() {
    let n = 0;
    let r = 0;
    for (let i = 0; i < items.length; ++i) {
        if (items[i] % 2 === 0) {
            n++;
            if (n <= 10000) {
                const m = items[i] + 1;
                r = r + m;
            }
        }
    }
}).add('For Loop 2', function() {
    let n = 0;
    let r = 0;
    for (let i = 0; i < items.length; ++i) {
        if (items[i] % 2 === 0) {
            n++;
            if (n <= 10000) {
                const m = items[i] + 1;
                r = r + m;
            } else {
                break;
            }
        }
    }
}).on('cycle', (event) => {
    console.log(String(event.target));
}).on('complete', function() {
    console.log('Fastest is: ' + this.filter('fastest').map('name'));
}).run({ async: true });

Code: [Select]
Linkier x 4,242 ops/sec ±5.49% (78 runs sampled)
Link x 3,786 ops/sec ±2.13% (91 runs sampled)
Lazy x 2,917 ops/sec ±2.87% (91 runs sampled)
For Loop x 2,213 ops/sec ±2.01% (96 runs sampled)
For Loop 2 x 11,052 ops/sec ±1.52% (97 runs sampled)
Fastest is: For Loop 2

What we learn here, is that hand-writing a for loop can be slower... The first for loop doesn't short circuit after 10,000 items, but that's on intention. How many times in writing a for loop you think of doing that? Therefore from.js, link.js and other libraries are going to be faster since they can make those common-sense decisions for you, and just automatically make your code faster.
6
Spherical News / Re: Forum updates thread
I really like the theme going on. It's easy on the eyes and says "Sphere". Thanks!
7
Same with Fat Cerberus. I didn't know Ctrl+PageUp/PageDown was a thing! I just tried in Chrome and it worked. Guess you learn something new every day.

I do use Shift+Insert to paste all the time, however. On a nice full keyboard, at least, it feels nicer with just the right hand.
8
  • Dispatch.onExit: Run some code on shutdown, after the event loop terminates.  This works even if the user manually closes the window!

I like this. This prevented me from writing a clean MMO in Sphere back in the day. I had to 'poll' every user to see if they were actually logged in or not every like 5 minutes. Good times, hahaha,
9
Since QSI won't have a source editor, I'm going to work on a Visual Studio Code extension for miniSphere API completion/documentation and possibly for interfacing with SSj.

I like this Visual Studio Code idea!
10
Spherical News / Re: Forum updates thread
We apparently lost our favicon, too. I was looking at my bookmarks and couldn't immediately see the Spherical icon.
11
Engine Development / Re: miniSphere 5.1.0
I actually just fixed that with Surface.Screen. I installed the engine and editor with the installer and I indeed see 5.1.0 in the about config.

Anyways, I'm going to try and see what I can do with the new API. Things are much different. Better, but different so, I'll have to learn a few things.
12
Engine Development / Re: miniSphere 5.1.0
So, I download a fresh, clean copy of MiniSphere 5.1.0 and I run a new, default game in the editor and I get a reference error. It says 'screen' is not defined.

I'm thinking of maybe creating games again, hahaha. I have a Raspberry Pi and I'd love to see if maybe it's possible to have Sphere games run on it someday.
13
Engine Development / Re: miniSphere 5.1.0
Merry Christmas! What you've done with Sphere in the last year is truly astonishing! Great work!!
14
Haha! I vote this Sphere GOTY 2017. :)
15
Engine Development / Re: miniSphere 5.0.0
Great work!! I'll definitely check this out when I get home!