This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

#1 2012-09-22 15:15:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

BBP.HTM (name might change!) is a collab between Hardmath and me. We plan to make a program based on Scratch, in HTML. BBP is block based programming.

I want to use mostly HTML4, as i mentioned, but tons of CSS3. jQuery is a must. There are several jQuery libraries that i'm sure we'll find useful as well.

I have to get off now, so we can discuss this more tomorrow.  smile

Last edited by scimonster (2012-09-22 15:38:13)

Offline

 

#2 2012-09-22 15:18:10

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

This will be really exciting. I've already been anticipating this over the last few days.  tongue
Good luck. :3

Offline

 

#3 2012-09-22 15:21:13

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#4 2012-09-22 15:22:32

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

blob8108 wrote:

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile

I believe that they are trying to 'recreate' Scratch in a web format.  wink

Offline

 

#5 2012-09-22 15:23:42

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

ProgrammingFreak wrote:

blob8108 wrote:

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile

I believe that they are trying to 'recreate' Scratch in a web format.  wink

But I thought we already had Snap! (And JSScratch, sb2.js, etc — but they're only players)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#6 2012-09-22 15:24:19

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

blob8108 wrote:

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile

Well, Snap! is a Scratch mod made in HTML5, right? We plan on doing something sort of like that. I actually want to take some ideas from them.

Offline

 

#7 2012-09-22 15:26:08

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

scimonster wrote:

Well, Snap! is a Scratch mod made in HTML5, right? We plan on doing something sort of like that. I actually want to take some ideas from them.

Snap is not a mod(ification), it's a web application inspired by Scratch.

Last edited by nXIII (2012-09-22 15:26:18)


nXIII

Offline

 

#8 2012-09-22 15:27:35

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

nXIII wrote:

scimonster wrote:

Well, Snap! is a Scratch mod made in HTML5, right? We plan on doing something sort of like that. I actually want to take some ideas from them.

Snap is not a mod(ification), it's a web application inspired by Scratch.

That's what I don't understand about modding Scratch in HTML...  hmm


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#9 2012-09-22 15:29:29

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

nXIII wrote:

scimonster wrote:

Well, Snap! is a Scratch mod made in HTML5, right? We plan on doing something sort of like that. I actually want to take some ideas from them.

Snap is not a mod(ification), it's a web application inspired by Scratch.

So call BBP.HTM a web app inspired by Scratch.

Offline

 

#10 2012-09-22 15:29:58

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

A MODification is when you MODify the ORIGINAL source code.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#11 2012-09-22 15:34:16

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Fine, i modified the title. Better?

Offline

 

#12 2012-09-22 15:34:40

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

scimonster wrote:

Fine, i modified the title. Better?

Well, it makes more sense now  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#13 2012-09-22 15:34:54

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

scimonster wrote:

Fine, i modified the title. Better?

The topic post still says mod.


nXIII

Offline

 

#14 2012-09-22 23:22:30

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

blob8108 wrote:

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile

... me neither. If you're planning to rewrite Scratch in HTML4/5 with some added features, then a) it wouldn't be a mod, b) we already have Snap!. We could mod Snap!, though.  tongue


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#15 2012-09-23 04:15:06

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Hardmath123 wrote:

blob8108 wrote:

scimonster wrote:

We plan to mod Scratch, in HTML. BBP is block based programming.

I don't understand quite what you're planning...  smile

... me neither. If you're planning to rewrite Scratch in HTML4/5 with some added features, then a) it wouldn't be a mod, b) we already have Snap!. We could mod Snap!, though.  tongue

I changed it so that it doesn't say mod. As several people have pointed out.  tongue

Snap! runs somewhat slowly. I think that pure elements would work faster. We could use ScratchBlocks for rendering, obviously modified.

I want it to be similar to Scratch, with many of the same blocks, but with some new ones, and the ability to create functions (i.e. reporters and booleans, not just stacks).

I want to implement Snap!'s idea of first class lists. Lambda is rather complicated, and i'm not sure about that. (I never fully understood it myself.)

There's also several new blocks i want to add to the default set, such as:
<if <bool> then [str1] else [str2]>
<true>
<false>
(type of [])
((num1) ^ (num2))
(ascii from [str])
([str] to ascii)
(letters (n1) to (n1) of [str])
([reverse/uppercase/lowercase/shuffle] of [str])
(index of [str1] in [str2])
(split [str1] into list by [str2])
(join [list] into string by [str])
(index of [str] in [list])
([reverse/shuffle/alphabetization] of [list])
(current [date/month/year/day of week/hour/minute/seconds/timezone])
(Unix timestamp)

If possible, i want to add some sort of regex support.

Offline

 

#16 2012-09-23 05:11:09

whizzer
Scratcher
Registered: 2008-05-27
Posts: 500+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

nXIII wrote:

scimonster wrote:

Well, Snap! is a Scratch mod made in HTML5, right? We plan on doing something sort of like that. I actually want to take some ideas from them.

Snap is not a mod(ification), it's a web application inspired by Scratch.

It's not inspired by Scratch, it's based off of BYOB 3.


http://i46.tinypic.com/33df6me.png I'm whizzer0 for all things Minecraft.

Offline

 

#17 2012-09-23 05:38:54

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Ok, I see what you're trying to do now, but I personally don't really agree with everything you said. Just to be clear, though: this is similar to what you're talking about, right?

I like the idea of trying to do a version of Scratch with elements, but I'm not sure about your aims. As many people point out, when you make a mod, you want to develop one feature extremely well rather than just shine it up with lots of random features and new blocks. I think we should pick one aim, and develop a block-based toolkit for that aim.

My suggestion would be to try to do something like Apple's Quartz Composer, except optimized for 2D interactive graphics/screensavers/visuals. The interface would be nested blocks instead of patches with data wires, because that's easier to code and more intuitive to use. We could add options to export your finished product as a pure image or a JS file which you could embed in a webpage and use as, for example, a fancy menu bar. Instead of focusing on stacks and scripts, it might be cool to work with functional programming concepts (i.e. Scheme). A rectangle linked to Google might look like this:

Code:

rect
 > (collapse-me triangle thing)
|x: 0
|y: 0
|h: 0
|w: 0
|color: [#00FF00]
|border: 1
... (you get the point) ...
|url: [http://www.google.com]

P.S. Lambda is basically a function without a name. So while in JS you do

Code:

function a() {...}

to make a normal name function, you would use

Code:

function() {}

to make an anonymous function. This would be useful if, for example, you want to input a function to some procedure:

Code:

function do_three_times(f) {
  f(); f(); f();
}
do_three_times(function() {alert("Hello, world!");});

Last edited by Hardmath123 (2012-09-23 05:43:06)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#18 2012-09-23 06:10:30

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

I didn't know lambda was just anonymous functions. That makes it a lot simpler to me.  smile

Waterbear is rather similar to this.

Quartz Composer sounds cool, but i feel like it's not what i was looking for. I wasn't just suggesting adding several random blocks and features; it's adding important functions for proper languages.
The feature i did want to go into that AFAIK hasn't been done in any other Scratch-based program is regexes. I do think that JS doesn't have the best regex support (PHP has it better IMO), but we could make do. So, perhaps like this:

Code:

/^[A-z]{3}\s[0-9]+\s(.*)\s(try|this|regex)$/g

Could be represented (showing the blocks being added):

Code:

(regex [] modifiers [])
(regex (join (start)) modifiers (global))
(regex (join (start) (count (3) [])) modifiers (global))
(regex (join (start) (count (3) ([A] - [z]))) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace)) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 [])) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9]))) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace)) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 [])) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 (anything))) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 (anything)) (whitespace)) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 (anything)) (whitespace) (any of (array []))) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 (anything)) (whitespace) (any of (array [try][this][regex]))) modifiers (global))
(regex (join (start) (count (3) ([A] - [z])) (whitespace) (more than 1 ([0] - [9])) (whitespace) (more than 0 (anything)) (whitespace) (any of (array [try][this][regex])) (end)) modifiers (global))

Yeah, i know it gets pretty long, but it's a great introduction to regular expressions!

Offline

 

#19 2012-09-23 06:12:27

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Let's chat.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#20 2012-09-23 06:22:03

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

I can't connect there; it won't log me in. Anyways, it's better for an open source project (which i'd like this to be) to have discussions out in the open.  smile

Offline

 

#21 2012-09-23 06:33:44

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

@Chat: Fair enough.

@Regexes: I think regexes are really overkill for block-based programming
(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b kind of overkill). Scratch was designed for young users, and so the block-based programming was optimized for their use. When you're using regexes, you want to just bang it out on the keyboard, not stack many blocks together to get it right—in fact, regexes were designed for compactness originally. Also, regexes use a sort of notation which introduces lots of data types. For example, I assume you would represent /abc*/ as (join [a] [b] (zero or more of [c])). What data type would (zero or more of [c]) be? For that matter, what data type does the regex return? And what are flags? It's too many questions, and it really complicated stuff. I'm not saying someone needs to come up with a GUI for regexes, because I honestly agree with you there. I'm saying blocks are a bad way to handle it.

@More features of a "real" language: Though I'm impressed by how powerful Scratch is, I don't think it's worth it to make it a full-fledged programming language. In the end, it's more convenient to anyone to just type it out. We don't want to recreate Scratch for the heck of it, or for that matter add blocks because they are useful. Like BYOB (my role-model mod), aesthetics is important, too. We want maximum functionality out of a set of blocks.  smile  Besides, as I mentioned above, we need to make sure we don't introduce too many data types of error catching will be a pain.

@Quatrz: What's wrong with Quartz? I really liked the way you could create totally beautiful screensavers out of a set of patches and shaders and stuff. Flurry was made in Quartz. That's impressive. I think functional graphics is a new twist to drag and drop which people haven't tried yet. Novelty is good! Imagine a programming language like this:

Code:

(rect
    origin: (point 0, 0)
    bounds: (point 100, 100)
    color: (color "red")
    color-if-highlighted: (color "green")
    color-if-hovered: (color "yellow")
    on-click-javascript: "…"
    link-to:"http://scratch.mit.edu"
)
(circle
    origin: (mouse position)
    radius: (timer)
)

It's like a combination of simplified CSS, PostScript, and Scheme, and it's interactive.

EDIT: I once made a toolkit where something like this makes a totally plausible menu:

Code:

window.onload=function() {
    World = document.getElementById("world");
    var can = new SpellCanvas(World);
    
    var box1 = new SpellObject(30,30,100,50);
    var box2 = new SpellObject(140,20,80,60);
    var box3 = new SpellObject(50,90,80,50);
    var box4 = new SpellObject(140,90,130,50);
    can.render=function(ctx) {
        box1.style={borderSize:5, r1:10, r2:10, r3:0, r4:10, borderColor:"darkOrange", color:"orange", text:"Search", shadow:true, fontColor:"darkOrange"};
        box2.style={borderSize:5, r1:10, r2:10, r3:10, r4:0, borderColor:"darkBlue", color:"blue", text:"Apps", shadow:true, fontColor:"darkBlue"};
        box3.style={borderSize:5, r1:10, r2:0, r3:10, r4:10, borderColor:"darkRed", color:"red", text:"Maps", shadow:true};
        box4.style={borderSize:5, r1:0, r2:10, r3:10, r4:10, borderColor:"green", color:"limeGreen", text:"Translate", shadow:true};
        
        box1.hover={shadow:false};
        box2.hover={shadow:false};
        box3.hover={shadow:false};
        box4.hover={shadow:false};
        
        box1.onclick=function() {
            window.open("http://www.google.com");
        }
        box2.onclick=function() {
            window.open("http://translate.google.com");
        }
        box3.onclick=function() {
            window.open("http://maps.google.com");
        }
        box4.onclick=function() {
            window.open("http://apps.google.com");
        }
        
        box1.render(can);
        box2.render(can);
        box3.render(can);
        box4.render(can);
    }
}

Last edited by Hardmath123 (2012-09-23 07:12:46)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#22 2012-09-23 09:12:35

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Hardmath123 wrote:

I think regexes are really overkill for block-based programming
(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b kind of overkill).

tongue

Have you seen the regex for validating email addresses according to the spec?


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#23 2012-09-23 09:47:20

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

blob8108 wrote:

Hardmath123 wrote:

I think regexes are really overkill for block-based programming
(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b kind of overkill).

tongue

Have you seen the regex for validating email addresses according to the spec?

lol


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#24 2012-09-23 10:23:07

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Hardmath123 wrote:

blob8108 wrote:

Hardmath123 wrote:

I think regexes are really overkill for block-based programming
(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b kind of overkill).

tongue

Have you seen the regex for validating email addresses according to the spec?

lol

Email addresses are so complicated that most (sensible) people now recommend validating emails by simply checking they contain "@".  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#25 2012-09-23 10:26:38

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

blob8108 wrote:

Hardmath123 wrote:

blob8108 wrote:


tongue

Have you seen the regex for validating email addresses according to the spec?

lol

Email addresses are so complicated that most (sensible) people now recommend validating emails by simply checking they contain "@".  tongue

Or actually writing a script to send a dummy email and recording any error messages.  tongue


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 
  • Index
  •  » Advanced Topics
  •  » BBP.HTM (Block-based-programming web app in HTML, inspired by Scratch)

Board footer