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

#1 2011-11-14 15:05:08

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

Case-sensitive string comparison, Base 64, and Copying text.

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screenshots/string_comparison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.

* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?

Many thanks!  smile


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

Offline

 

#2 2011-11-14 15:59:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Case-sensitive string comparison, Base 64, and Copying text.

hey, some pretty innovative ideas for saving! I never thought of data storage in long strings!

How many tiles are there in this thing? Maybe a base 16 wouldn't be too bad.

Is there a reason why you can't use a base 32, for example? The 26 letters + 10 numbers would be perfect for a 32bit storage (with only 4 waste characters)  smile  I would consider this as an option, unless it really becomes difficult to store your tile data in a non-square number.

As for solving the Aa Bb problem, I'm not sure whether there is any go-around. It's been tried before, and there have been successful steps forward, but I can't tell you whether or not the target has been reached because I simply do not know.

Good luck with your system anyway!

Offline

 

#3 2011-11-14 16:29:35

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: Case-sensitive string comparison, Base 64, and Copying text.

blob8108 wrote:

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screens … arison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.

* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?

Many thanks!  smile

As far as I know, there should be a Spanish or Italian or Greek or Russian character for each letter in the alphabet.


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#4 2011-11-14 16:43:30

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Case-sensitive string comparison, Base 64, and Copying text.

cocolover76 wrote:

blob8108 wrote:

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screens … arison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.

* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?

Many thanks!  smile

As far as I know, there should be a Spanish or Italian or Greek or Russian character for each letter in the alphabet.

I think we're looking for something the user can enter here, not more characters. If you really needed more characters, you could start using symbols and stuff!

Offline

 

#5 2011-11-15 09:57:57

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

blob8108 wrote:

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screens … arison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?
You can MAKE an ASCII of () block.
* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.
You can copy from list viewers.
* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?
I honestly have no idea what you're doing. But good luck, anything to speed Scratch up is good.
Many thanks!  smile

wink


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

Offline

 

#6 2011-11-15 09:58:16

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

Yes.

Offline

 

#7 2011-11-15 11:08:55

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Case-sensitive string comparison, Base 64, and Copying text.

check my compressor!
(some optimizations have to be done  hmm )

Offline

 

#8 2011-11-16 13:07:32

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

LS97 wrote:

hey, some pretty innovative ideas for saving! I never thought of data storage in long strings!

Sadly, it's not my idea...  tongue

LS97 wrote:

How many tiles are there in this thing? Maybe a base 16 wouldn't be too bad.

Is there a reason why you can't use a base 32, for example? The 26 letters + 10 numbers would be perfect for a 32bit storage (with only 4 waste characters)  smile  I would consider this as an option, unless it really becomes difficult to store your tile data in a non-square number.

As for solving the Aa Bb problem, I'm not sure whether there is any go-around. It's been tried before, and there have been successful steps forward, but I can't tell you whether or not the target has been reached because I simply do not know.

Good luck with your system anyway!

There are 300 tiles, which can each have a value of 0 to 3. This makes 2 bits of information.

With base 32, you get 5 bits of data, which makes fitting in 2-bit tiles really awkward (You'd have to spread 3 tiles across 2 bytes) -- but yes, that could work.  smile

Thanks!

Last edited by blob8108 (2011-11-16 13:16:37)


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

Offline

 

#9 2011-11-16 13:08:52

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

cocolover76 wrote:

As far as I know, there should be a Spanish or Italian or Greek or Russian character for each letter in the alphabet.

That's a thought; I could try using non-Roman characters. Moving to Unicode could get messy, though - it's more likely to get mangled  hmm  And as LS97 pointed out, it makes it harder for the user to enter.

Last edited by blob8108 (2011-11-16 13:10:31)


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

Offline

 

#10 2011-11-16 13:11:24

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

scimonster wrote:

Yes.

Thank you!  smile  Lists is quite a good idea, and should at least solve the case-sensing problem. I shall try this!


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

Offline

 

#11 2011-11-16 16:29:46

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Case-sensitive string comparison, Base 64, and Copying text.

Just for fun and inspiration, I compiled a list of special charaters. You won't need them, I know, but I was extremely bored  big_smile

á ß ç Ð é ƒ ġ Ĥ í ĵ ķ Ĺ ɱ ń ó ¶ ơ ŗ ŝ ţ µ ⱱ ŵ ẋ Ŷ ž

There, now I can be bored again...

Offline

 

#12 2011-11-16 22:01:59

MathIncognito
New Scratcher
Registered: 2011-11-16
Posts: 11

Re: Case-sensitive string comparison, Base 64, and Copying text.

Nice idea! I think I made a base64 converter in BYOB once. I might look at it again...

Offline

 

#13 2011-11-25 21:44:14

Dominic1
Scratcher
Registered: 2009-07-30
Posts: 89

Re: Case-sensitive string comparison, Base 64, and Copying text.

blob8108 wrote:

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screens … arison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.

* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?

Many thanks!  smile

The <list contains ?> block is case sensitive. Simply add "A" to a list and see if <list contains a?> says true or false.


http://i49.tinypic.com/oiwvh5.jpg

Offline

 

#14 2011-11-26 08:58:38

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: Case-sensitive string comparison, Base 64, and Copying text.

blob8108 wrote:

I was trying to write a base 64 converter for a small tile-based project: the idea being to compress the data describing the tiles to be (slightly) shorter than a 300-character long sequence of the digits 0-3. I thought no-one would bother typing out such a long sequence (sadly, compressing it wasn't as effective as I'd hoped  sad ).

Base 64 uses the digits ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789-_ to describe the numbers 0-63, so in theory, I could fit three times as much data into each byte.

Then, of course, I realised Scratch's string comparison operators are case-insensitive — ie.
http://dl.dropbox.com/u/9598124/Screens … arison.png

...which means that I can't use base 64 after all. I could do base 16 (0123456789abcdef), but then I only get two tiles per byte, which isn't a lot.


So:

* Is there any way of doing case-sensitive string comparison in Scratch?
Yes, Sci Linked to the wiki  roll
* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy.
you can import vars and list
* Any thoughts about what I'm doing? Have you successfully achieved any amount of compression in Scratch? Have you made "codes" for a tile-based game, or something similar? Is it even worth doing?
Ive done base 16, never 64. i just used two base 16 digits [16*16=256]
Many thanks!  smile

Last edited by hello12345678910 (2011-11-26 08:58:56)


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#15 2011-11-27 00:30:14

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy

.
You can copy from lists in the flash player.  big_smile


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

Offline

 

#16 2011-11-27 03:30:30

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

Re: Case-sensitive string comparison, Base 64, and Copying text.

MathWizz wrote:

* Can we copy text straight out of Scratch yet? I think you can paste into the "ask" field, but I didn't think you could copy

You can copy from lists in the flash player.  big_smile

...can you?  big_smile  That'd be great — I can't make it work, though!  sad


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

Offline

 

Board footer