Live data from Hacker News

Google Blockly - a visual programming language

code.google.com

101–110 of 129 posts

Re: Google Blockly - a visual programming language

#101
I like it a lot, and look forward to trying it out on my girlfriend to see how a non-coder responds to it.

Whilst working out the while loop however, I put the code to loop outside the block instead of inside, thereby making an infinite loop. Now the Chrome browser window is completely unresponsive, and won't even close, so it seems I have to kill chrome to get rid of it.

Other than that, cool!

Re: Google Blockly - a visual programming language

#102

I like it a lot, and look forward to trying it out on my girlfriend to see how a non-coder responds to it. Whilst working out the while loop however, I put the code to loop outside the block instead of inside, thereby making an infinite loop. Now the Chrome browser window is completely unresponsive, and won't even close, so it seems I have to kill chrome to get rid of it. Other than that, cool!

> and look forward to trying it out on my girlfriend to see how a non-coder responds to it.

I would be really interested to hear about how this goes. Not in a horrible "Hurr durr look at this woman, she can't even do x=y, you have ten x, how many y do you have?" way.

What problems will you get her to do? How much help will you give? I think it's really interesting to see how different people approach different problems.

Re: Google Blockly - a visual programming language

#104
post #95

Earlier quoted context omitted.

Still, the blocky code reads "count with i from 0 to (get n)", but the loop generated is accessing A[0-1]..A[n-1]. JavaScript is forgiving here, but A[0..n] is not the same as A[-1..(n-1)] (at least I'm not familiar enough with JavaScript to think otherwise).

If they are mapping index 1 to index 0, then it makes sense that 0 would map to -1 since it is one less than the first index. The bug is in the blockly sieve. As an aside, Lua also uses 1-based indexing.

Yeah, I didn't realize it was 1-indexed until you guys pointed it out.

Unsurprisingly, it still works (it just loops a few too many times).

Re: Google Blockly - a visual programming language

#105
post #59

The UI for this reminds me a lot of Scratch from MIT.

Google also had App Inventor similar to that. I don't understand why they are building this. Didn't they just kill App Inventor because they wanted to "focus" or something? So why this now?

App Inventor is here now: http://www.appinventor.mit.edu/

Re: Google Blockly - a visual programming language

#106

Cool beans. My suggestion based on no evidence what-so-ever is that I'd like to see something like this in a richer environment. To give a bad example, VB. The original VB had forms (maybe it still does). You'd make a form. Double click the button and add code for "onclick" basically. I guess maybe that was inspired by Hypercard. In any case it was really easy to see how to make a useful program because of the struct…

Unity3D has a few 3rd party visual programming languages already, but they're flow-based unlike blocky.

http://u3d.as/content/neo-pax/antares-universe-vizio-free/29...

http://www.detoxstudios.com/products/uscript/

http://www.hutonggames.com/index.html

Re: Google Blockly - a visual programming language

#107

I remembered a trick about mazes: if you keep your hand on the right wall, you'll eventually reach the end of the maze (assuming that the beginning and end share a contiguous wall) http://imgur.com/i2uOj Fun puzzle!

The same is true for the left side:

http://imgur.com/fwOMy

Re: Google Blockly - a visual programming language

#108
post #98

I want something to code on my smartphone, without having to type more than is necessary. I expected this kind of thing to arrive. I hope they become more than a little toy.

Microsoft's TouchDevelop is pretty good for that. There's a surprising amount of cool things being made with it. WP7 exclusive at this point, though.

Re: Google Blockly - a visual programming language

#110
post #61

i solved a problem featured on the yc company interviewstreet.com codesprint. the problem: Count the number of one-bits from 0 to 2^n - 1, for n from 1 to 20. my solution: http://i.imgur.com/hUxt0.png when you run the solution: Number of one-bits in 1 bit numbers from 0 to 1 = 1 Number of one-bits in 2 bit numbers from 0 to 3 = 4 Number of one-bits in 3 bit numbers from 0 to 7 = 12 Number of one-bits in 4 bit numbers…

Take some of that time to figure out the math and the code becomes trivial: for (n = 1; n A short explanation: http://mathbin.net/98435

Dude, thanks for that! I really enjoyed the closed form solution, though there is absolutely no way I could have come up with that under time-pressure in a codesprint.

My solution was rather trivial: The base case is 2 bit numbers, which are 00,01,10 and 11. The total number of one-bits is 0+1+1+2 = 4.

From then on, I just used recursion.

3 bit numbers are really 2 bit numbers with a '0' prefixed half the time, '1' prefixed the other half of the time. There are 8 3 bit numbers, so you are tacking on the '1' 8/2 = 4 times. So 4 + twicetwobits = 4+2 x 4 = 12.

4 bit numbers are really 3 bit numbers with a '0' prefixed half the time, '1' prefixed the other half of the time. There are 16 4 bit numbers, so you are tacking on the '1' 16/2 = 8 times. So 8 + twicethreebits = 8+2 x 12 = 32

If you write out the recurrence relation, it looks like:

f(n) = 2^(n-1) + 2 x f(n-1)

This seems silly since you can neither define f(n) nor recursively call f(n-1) in Blockly just yet. But if you memoize the f(n-1) results in a list, the recurrence is computable by straight iteration - which is exactly my Blockly solution.

Post reply on HN