Basically, Its Minecraft

[SethBling] really likes Minecraft. How can you tell? A quick look at his YouTube channel should convince you, especially the one where he built a full-blown BASIC interpreter in Minecraft. It is not going to win any speed races, as you might expect, but it does work.

For novelty and wow factor, this is amazing. As a practical matter, it is hard to imagine the real value since there are plenty of ways a new programmer could get access to BASIC. Still, you have to admire the sheer audacity of making the attempt. One Hackaday poster (who shall remain nameless) once won a case of beer by betting someone he or she could write a BASIC compiler in BASIC, so we aren’t sticklers for practicality.

Because the interpreter is so slow, we had wished the prime number algorithm in the demo video (see below) had been just a little more efficient. First, you don’t have to check numbers greater than the square root of the target number, since any factor in that range will reveal another factor that is greater than the square root. If the BASIC interpreter didn’t have a square root function, you could, at least, stop at half the target number. Of course, you could also keep a list of primes and skip testing any non-prime factor. After all, if (for example) 15 evenly divides your number, so will 5 and 3, right? But that’s algorithm design and takes nothing away from the BASIC.

We’ve seen a 6502 running Forth in Minecraft, so it’s good to see BASIC getting its day in the sun as well. We still see pockets of BASIC interest, like the fairly new interpreter that turns an ESP8266 into an ersatz BASIC Stamp.

40 thoughts on “Basically, Its Minecraft

      1. The function has the advantage that it’s purpose is clear, but it’s awful.

        There are some fast ways round the problem of calculating the square root, by repeatedly dividing the number by 2 until you reach 1 (bit counting), add 1 to the number of bits and again if it’s not even, then multiplying 1 by 2 – b/2 times produces a number that isn’t less than floor(root(x)) and isn’t more than twice that.

        If the version of BASIC keeps both results from the division, then square root isn’t even needed for the alg, the point where the division result is smaller than the divisor means the root has been crossed. That is an extra compare per division though.

      2. You don’t need to calculate sqrt() for that. For instance, if your number N to be checked is 42, you only have to check up through sqrt(42). Instead of calculating that, square the number being checked, and compare that to 42. All you need is multiplication or squaring.

    1. oh please!

      this gets back to me postulating that infinity is an odd number.

      consider that any number can be expressed in any base and still be the same number.

      from there, let us consider infinity expressed as an infinite number of bits, all “1”.

      forget all the bits except bit 0 or 2^0, which is 1

      any number expressed as binary with bit 0 = 1, is an odd number.

      so an integer infinity is an odd number.

      1. Why did you decide that BIT_0 must always be set to 1 in the representation of infinity?

        It’s interesting how you point out that “any number can be expressed in any base”, but didn’t think about the implications of that on your theory. In your breakdown, you simply claim that the lowest bit is at its highest value always, but what happens when you choose a different base, like 3 for example. Now, the highest number you can store in a digit is 2, which is even. So, in base-3, infinity would always be even, according to your strange theory.

          1. That’s not what Patrick said though, he was asking why it was set. It’s kind of like arguing that if you fill up 3 infinite lines the result must be odd.

            This reminds me of the Hilbert hotel, where the page has to zigzag the corridor instead of the more efficient one side at a time because he’d never return to do the other side.

        1. Well, in base-3, 10 is odd, 12 is odd, 22 is even.

          Hypotheses: if the base is even, thou should test if the number is odd or even in the lowest digit. If the base is odd, yousa should test if da number is odd or even inda second lowest digit.

      2. Mmmkay, I’m not sure an integer infinity is a thing, but because 0.1111… is equal to 1 in binary, in the same way 0.9999.. is equal to 1 in decimal, then you’ve just ‘proved’ infinity-1 is odd, which should mean infinity is even.

    2. To search for a prime he could start from 7, and make the FOR loop start at 3 (as we know that no prime number is even (except the number 2 itself)). Just print 2,3,5 directly.

      Another simple and fast idea is to add 1 or subtract 1, and test if modulo 6 gives 0, as every prime number over 3 is in form 6*k +- 1. eg. 5 = 6*1-1 , 7=6*1+1 , 11=6*2-1, 13=6*2+1 … 29=6*5-1 …97=6*16+1

      1. To be precise about 6*k +- 1 (can’t edit the original):
        If it’s not in 6*k +-1, skip checking as it’s not prime. It will at least skip every third number in exchange for few tests.

        Or start with 6, and add 6 every time, and just test +1 -1 numbers. No futile %6 tests in that case.

        1. $15?

          It’s $26.95 for the PC version
          It’s just shy of $20 a pop for any of the console versions. The 360 version is on sale for $16.95.
          The cheapest by far is the Android version at $6.99.
          MS has a “Win10” version as a freebie with their PC version.
          Raspi has a free “open” version.

          1. And while he was typing up the lie I (really did) downloa and installed Voxelands on 5 machines, found a small bug that was specific to the OS version I use, devise a workaround, contacted the developers and had them update the website to let people know the easy workaround. Try doing that with commercial software! When it comes to an agile response nothing beats FOSS.

    1. Did you really need to post that? Can you not let someone who’s put together something rather impressive out of a kid’s game have their moment to shine?

      I’m a fan of OSS, for sure, but can you not accept that Minecraft might actually be enjoyable, and more feature-complete out of the box for a lot of people? Not to mention that it’s available on nearly every console and device under the sun, which helps a lot for kids that may only not have a personal computer of their own.

      It’s a game. Made by a company to turn a profit. Yeah. Boo. Hiss. But you know what? It’s actually pretty FUN. Who cares if it’s free/gratis?

      Yes I’m sure you could add all the missing features to MineTest if you had several years and a team of developers, or at least a really dedicated community, but as it stands MineTest is very limited in comparison. Someday, maybe it won’t be… but for now, let’s congratulate SethBling on his rather amazing accomplishment.

          1. Not yet, Ray tells me that they have not got that AGI aspect of the search working yet but they are working on it, yeah the bit where Google knows what you don’t know and tells you before you even know what to search for. And yeah that Ray, the boss of their AI effort. So back in your hole troll.

        1. Not faulting q2dg for posting abut voxelands or minetest. I’m faulting q2dg for immediately saying “I’m not interested in this. It doesn’t meet my specific needs.”, while contributing nothing about the actual HAD topic.

          Also, Minecraft definitely also has farming, and electric circuits with pistons, lamps and logic gates.
          http://minecraft.gamepedia.com/Farming#Food_Farming
          http://minecraft.gamepedia.com/Redstone_circuit
          http://minecraft.gamepedia.com/Piston
          http://minecraft.gamepedia.com/Lamp
          http://minecraft.gamepedia.com/Logic_circuit

          1. They would be add on mods, the fork is distributed with them, not extra effort required. My kids have given the new one the thumbs up and like the small differences the new one has too. Either one is very hackable if later they are interested in that.

          2. @Dan, those are not add-on mods. Those are all part of non-modified Minecraft. That, and the fact that Voxelands is missing simple things like a sprint function, proper caves/dungeons, etc…

          3. We have both installed here, so nope you are wrong (perhaps they are compiled in for some distributions?). My little team of testers say Vox is better and given that keeping them happy is the point of the exercise…

    1. Doesn’t work without either space compression mods, computercraft or similar, or chunkloaders, and would bring even a fairly powerful computer to its knees due to lack of threading.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.