This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1951 2011-09-04 12:52:37

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

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

sparks wrote:

So I've made it as far as working out how far apart two days in the same month are (I know, amazing huh?) But the months are the hardest because they're all different!

days between d:$Number$ m:$Number$ y:$Number$ and d:$Number$ m:$Number$ y:$Number$

Code:

t3 = t6
ifTrue:[
     t2 = t5
     ifTrue:[
          ^(t4 - t1) 
     ]
]

I've got to the point of it calculating it all with a BYOB script (I love my custom blocks!). But it take FOREVER to run. I have an idea to speed it up, but I haven't perfected it yet.

Could you convert that do Squeak?

Offline

 

#1952 2011-09-04 12:55:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

The problem is that it technically has to run through all the months and years between the two dates and check the number of days for each passing month  sad


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1953 2011-09-04 13:07:22

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

jurk wrote:

Can you save BYOB blocks In BYOB?
For example I make a Byob block And I like it And wont it again But I closed it can I Save a block

There's no such thing as a block file, but you can save the project or export the sprite. The downloadable BYOB blocks in the library are BYOB sprites.

Rely I did knot know that...
That was so dumb of me I was trying to copy them.
You helped so much thanks  smile


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

#1954 2011-09-04 13:24:58

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Could you convert that do Squeak?

No. I still don't know squeak. But when I finish I'll post a the project on Mod Share.

jurk wrote:

Rely I did knot know that...
That was so dumb of me I was trying to copy them.
You helped so much thanks  smile

No prob!


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1955 2011-09-04 13:42:00

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

I can probably convert it to smalltalk for a block if I see the script... though it's been a while.... I'll have to look up how for and while loops work again... Smalltalk is so different to any other language, it's hard to remember the syntax.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1956 2011-09-04 13:55:40

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

I can probably convert it to smalltalk for a block if I see the script... though it's been a while.... I'll have to look up how for and while loops work again... Smalltalk is so different to any other language, it's hard to remember the syntax.

I remember it pretty well I think, even though it's been a while.

Offline

 

#1957 2011-09-04 14:00:11

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

sparks wrote:

I can probably convert it to smalltalk for a block if I see the script... though it's been a while.... I'll have to look up how for and while loops work again... Smalltalk is so different to any other language, it's hard to remember the syntax.

I have the script complete, but Mod share isn't working. I could post pictures if you want.


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1958 2011-09-04 14:02:20

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

refresh my memory?

if:

t1 = t2
ifTrue:[

]

for:

t1 timesRepeat:[

]

while:

???

I think the first two are right, I've forgotten how to do while. Also, do you have any idea when a loop needs a period after the ] and when not?


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1959 2011-09-04 14:05:56

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

refresh my memory?

if:

t1 = t2
ifTrue:[

]

for:

t1 timesRepeat:[

]

while:

???

I think the first two are right, I've forgotten how to do while. Also, do you have any idea when a loop needs a period after the ] and when not?

Looks right.  tongue  I don't remember while either.
You need a period after lines and ]s.

Offline

 

#1960 2011-09-04 14:07:07

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

SSBBM wrote:

sparks wrote:

I can probably convert it to smalltalk for a block if I see the script... though it's been a while.... I'll have to look up how for and while loops work again... Smalltalk is so different to any other language, it's hard to remember the syntax.

I have the script complete, but Mod share isn't working. I could post pictures if you want.

pictures is fine  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1961 2011-09-04 14:08:44

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Looks right.  tongue  I don't remember while either.
You need a period after lines and ]s.

Well no, it's not as simple as that. Periods go after a line where a variable is set and the code I gave above to calculate leap years does not work if periods are placed after all the ]'s.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1962 2011-09-04 14:10:59

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

Re: ITopic: Welcome to your local block library!

sparks wrote:

scimonster wrote:

Looks right.  tongue  I don't remember while either.
You need a period after lines and ]s.

Well no, it's not as simple as that. Periods go after a line where a variable is set and the code I gave above to calculate leap years does not work if periods are placed after all the ]'s.

Well, I think also no period after a right bracket if it's right before another, or if it is part of an ifTrue: [ ] ifFalse: []. sequence.

Offline

 

#1963 2011-09-04 14:33:49

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: ITopic: Welcome to your local block library!

http://www.picamatic.com/view/7843112_Screenshot/


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

#1964 2011-09-04 14:53:34

sci_test
Scratcher
Registered: 2011-06-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

jurk wrote:

http://www.picamatic.com/show/2011/09/04/10/31/7843112_412x462.jpg


[signature removed - please be respectful]
Last edited by scimonster (1970-01-01 00:00:00)

Offline

 

#1965 2011-09-04 15:15:26

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: ITopic: Welcome to your local block library!

Here it is:
http://i.imgur.com/yHOFl.gif
It uses three custom blocks:
The (if <> () else ()) that's in the library,
the <() is a leap year?> block (based on the code you supplied)
http://i.imgur.com/y2XHv.gif,
and the (days in month () in year ()) that I made and uses the <() is a leap year?> block http://i.imgur.com/wSPxC.gif


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#1966 2011-09-04 15:22:09

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

That... could take a while to convert to smalltalk... I can see why it takes a while and can't really think how to speed it up...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1967 2011-09-04 16:02:05

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Your "days in month $Number$ in year $Number$" in smalltalk.

There's probably a way to optimise this using arrays but I don't know how to use them in smalltalk and this is fast as blinking anyway:

Code:

|leap|
(t2/100) = (t2/100) rounded
ifTrue:[
(t2/400) = (t2/400) rounded
ifTrue:[
     leap_'true'.
     ]
     ifFalse:[
          leap_'false'.
     ]
]
ifFalse:[
      (t2/4) = (t2/4) rounded
     ifTrue:[
          leap_'true'.
     ]
     ifFalse:[
          leap_'false'.
     ]
].
t1 = 1
ifTrue:[
^ 30
].

t1 = 3
ifTrue:[
^ 30
].

t1 = 5
ifTrue:[
^ 30
].

t1 = 7
ifTrue:[
^ 30
].

t1 = 8
ifTrue:[
^ 30
].

t1 = 10
ifTrue:[
^ 30

].
t1 = 12
ifTrue:[
^ 30
].
t1 = 2
ifTrue:[
     leap = 'true'
     ifTrue:[
          ^ 29
     ]
     ifFalse:[
          ^28
     ]
].


t1 = 4
ifTrue:[
^ 31
].

t1 = 6
ifTrue:[
^ 31
].

t1 = 9
ifTrue:[
^ 31
].

t1 = 11
ifTrue:[
^ 31
].

http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1968 2011-09-05 21:28:43

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

...someone do a Scratch Blocks update...

...please!!!

Last edited by Greenatic (2011-09-05 21:28:56)

Offline

 

#1969 2011-09-06 02:15:12

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

Re: ITopic: Welcome to your local block library!

Sci.  tongue  (sigh, geddit?)

Eventually. 300 posts BTW, Greenatic!

Offline

 

#1970 2011-09-06 15:16:25

owetre18
Scratcher
Registered: 2009-07-01
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Sci.  tongue  (sigh, geddit?)

Eventually. 300 posts BTW, Greenatic!

More like Greenatic has 300 posts.

Offline

 

#1971 2011-09-06 16:41:01

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

scimonster wrote:

Sci.  tongue  (sigh, geddit?)

Eventually. 300 posts BTW, Greenatic!

Yeah, I know.  My 300th was elsewhere though.

The problem seems to be this:

1) No current librarians can or are willing to do an update.
2) The current librarains refuse to hire any more, saying that there are plenty and the Library is doing fine.  ( ???? )

Contradiction, anyone?

Offline

 

#1972 2011-09-06 16:48:15

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: Welcome to your local block library!

It isn't really a contradiction, I mean, people can see your block submissions as soon as they're posted and it's easier for us to do bulk updates!  smile

Last edited by sparks (2011-09-06 16:48:55)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#1973 2011-09-06 16:51:29

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

It isn't really a contradiction, I mean, people can see your block submissions as soon as they're posted and it's easier for us to do bulk updates!  smile

We've been waiting for a Scratch block update since July 20th.

Last edited by Greenatic (2011-09-06 16:51:45)

Offline

 

#1974 2011-09-06 16:52:14

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: ITopic: Welcome to your local block library!

sparks wrote:

Your "days in month $Number$ in year $Number$" in smalltalk.

There's probably a way to optimise this using arrays but I don't know how to use them in smalltalk and this is fast as blinking anyway:

Code:

|leap|
(t2/100) = (t2/100) rounded
ifTrue:[
(t2/400) = (t2/400) rounded
ifTrue:[
     leap_'true'.
     ]
     ifFalse:[
          leap_'false'.
     ]
]
ifFalse:[
      (t2/4) = (t2/4) rounded
     ifTrue:[
          leap_'true'.
     ]
     ifFalse:[
          leap_'false'.
     ]
].
t1 = 1
ifTrue:[
^ 31  //this was wrong
].

t1 = 3
ifTrue:[
^ 31  //and this
].

t1 = 5
ifTrue:[
^ 31  //and this
].

t1 = 7
ifTrue:[
^ 31  //and this
].

t1 = 8
ifTrue:[
^ 31  //and this
].

t1 = 10
ifTrue:[
^ 31  //and this

].
t1 = 12
ifTrue:[
^ 31  //and this
].
t1 = 2
ifTrue:[
     leap = 'true'
     ifTrue:[
          ^ 29
     ]
     ifFalse:[
          ^28
     ]
].


^30  //i made this bit shorter
].

You got which months have 30 days the wrong way around i fixed it.  and  also is ANYONE going to do an update???

Last edited by joefarebrother (2011-09-06 17:00:41)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#1975 2011-09-06 17:02:01

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

joefarebrother wrote:

You got which months have 30 days the wrong way around i fixed it.  and  also is ANYONE going to do an update???

Yeah.  I know I'm probably being very annoying, but seriously, someone ought to either do an update or hire a new librarian who will.

Offline

 

Board footer