[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.

To search for a prime you only need to trial divide up to floor(sqrt(x)).

Yes, but then he has to implement sqrt(x), which is non-trivial given how low-level he’s starting. Divide-by-2 is a decent substitute, given the situation.

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.

Or you try this https://hackaday.io/project/8137-prime-factor-reduction-sieve.

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.

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.

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.

in assembler if you want to see if a number is odd or even, you check if bit 0 is set.

it’s the equivalent of

if (num/2) int(num/2) then

result = odd

else

result = even

ROL

BRCS

doh! I mean

ROR

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.

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.

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.

Infinity is not a number.

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

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.

Mersenne would be proud

I’m not interested in Minecraft. It’s not free (nor gratis). Let’s move on to another thing like Minetest or Voxelands

No one is forcing you to purchase it? It’s a pretty cool game that’s at least getting people interested in making/coding.

It’s also very inexpensive compared to other games. it only costs $15 other games cost $50+. I don’t mind paying for something when it is priced low.

$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.

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.

@Dan

What was it that I wrote was a lie?

Not you the other guy, was communicating too you not about you, sorry for the confusion.

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.

I for one are very grateful for q2dg’s post as it informed me of the existence of Voxelands which contains features my kids were interested in, namely “farming, electric circuits – with pistons, lamps, and logic gates” http://www.voxelands.com/about.html

Whereas you have actually being far less helpful.

Ah yes, but couldn’t you simply google for that information?

Now we are all wrong.

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.

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

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.

@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…

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…

Let’s stop posting most of these electronics-related projects, the parts are not free.

See my other post re Voxelands and it’s electronics and logic blocks.

This is better in the “It is hackable” sense, http://www.minetest.net/ or so my kids tell me….

Now make a java virtual machine and run minecraft inside minecraft

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.

Bah. The guy who ports Java to minecraft will get the kudos…compiling Minecraft in Minecraft would be the supreme accomplishment.

Of course, it’ll have a runtime on the order of Deep Thought :-) https://en.wikipedia.org/wiki/List_of_minor_The_Hitchhiker%27s_Guide_to_the_Galaxy_characters#Deep_Thought

FWIW, I happen to play both Minetest AND Minecraft, and happen to enjoy them both.

Bitching about lack of practicality? With something awe inspiring like this? wth?