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
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 blockThere'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
Offline
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
No prob!
Offline
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.
Offline
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
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.
Offline
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?
Offline
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. I don't remember while either.
You need a period after lines and ]s.
Offline
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
Offline
scimonster wrote:
Looks right. 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.
Offline
sparks wrote:
scimonster wrote:
Looks right. 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
Here it is:
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)
,
and the (days in month () in year ()) that I made and uses the <() is a leap year?> block
Offline
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:
|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 ].
Offline
...someone do a Scratch Blocks update...
...please!!!
Last edited by Greenatic (2011-09-05 21:28:56)
Offline
Sci. (sigh, geddit?)
Eventually. 300 posts BTW, Greenatic!
Offline
scimonster wrote:
Sci. (sigh, geddit?)
Eventually. 300 posts BTW, Greenatic!
More like Greenatic has 300 posts.
Offline
scimonster wrote:
Sci. (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
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!
Last edited by sparks (2011-09-06 16:48:55)
Offline
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!
We've been waiting for a Scratch block update since July 20th.
Last edited by Greenatic (2011-09-06 16:51:45)
Offline
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)
Offline
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