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

#1 2012-12-08 11:10:23

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

A few things I need to do but what I'm very stuck on

For my course at school I need to make:

- An algorithm that will swap over two items in the array, the user supplies the two positions

- An algorithm that in a separate array will store the lengths of the items (e.g. how many characters in each array item string). The positions must match up, e.g.

Blab (4)

Blaba (5)

Bler (3)


- An algorithm that in a new array stores the same items but without any vowels in them


Can someone please help me with the scripting of these three algorithms?

Thanks in advance.

Offline

 

#2 2012-12-08 17:46:46

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

Please respond. I am anxious to get this task completed.

- Jed Morris

Offline

 

#3 2012-12-08 17:49:06

DeckSTAHP
New Scratcher
Registered: 2012-12-08
Posts: 1

Re: A few things I need to do but what I'm very stuck on

Connor Pedersen, cease with the immaturity please.

- The actual Jed Morris.

Offline

 

#4 2012-12-08 17:50:24

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

DeckSTAHP wrote:

Connor Pedersen, cease with the immaturity please.

- The actual Jed Morris.

Uhh, Mr Morris, that is very inappropriate. Keep on topic, gentlemen.

Offline

 

#5 2012-12-08 17:52:33

bojo4evah
New Scratcher
Registered: 2012-12-08
Posts: 2

Re: A few things I need to do but what I'm very stuck on

MasterAnonymous wrote:

DeckSTAHP wrote:

Connor Pedersen, cease with the immaturity please.

- The actual Jed Morris.

Uhh, Mr Morris, that is very inappropriate. Keep on topic, gentlemen.

Mr. Morris, you nerd.
Pedersen, shut your mouth!

Offline

 

#6 2012-12-08 17:53:26

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

bojo4evah wrote:

MasterAnonymous wrote:

DeckSTAHP wrote:

Connor Pedersen, cease with the immaturity please.

- The actual Jed Morris.

Uhh, Mr Morris, that is very inappropriate. Keep on topic, gentlemen.

Mr. Morris, you nerd.
Pedersen, shut your mouth!

Roight, that's the ten minutes of banter over. Time to get serious now.

Again, keep on topic gents and Mr Morris.

Offline

 

#7 2012-12-08 17:55:16

MrFlash67
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: A few things I need to do but what I'm very stuck on

Back on topic, please, people! This looks very complex, may I suggest BYOB or a different Scratch Mod?


Who would win, SOPA or PIPA?

Offline

 

#8 2012-12-08 19:03:49

mozzbo
New Scratcher
Registered: 2012-12-08
Posts: 2

Re: A few things I need to do but what I'm very stuck on

This is really easy!

I just done it in a few minutes

JD

Offline

 

#9 2012-12-09 03:45:38

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

mozzbo wrote:

This is really easy!

I just done it in a few minutes

JD

Sharing is caring!

Offline

 

#10 2012-12-09 04:49:29

mozzbo
New Scratcher
Registered: 2012-12-08
Posts: 2

Re: A few things I need to do but what I'm very stuck on

MasterAnonymous wrote:

mozzbo wrote:

This is really easy!

I just done it in a few minutes

JD

Sharing is caring!

I don't share...

and I don't care...

So there !

Offline

 

#11 2012-12-09 05:38:54

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

mozzbo wrote:

MasterAnonymous wrote:

mozzbo wrote:

This is really easy!

I just done it in a few minutes

JD

Sharing is caring!

I don't share...

and I don't care...

So there !

You are one creepy individual.

Offline

 

#12 2012-12-09 06:05:20

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: A few things I need to do but what I'm very stuck on

MasterAnonymous wrote:

For my course at school I need to make:

- An algorithm that will swap over two items in the array, the user supplies the two positions

If you're saying get 1 item, and replace it with a different item in the list and vice versa, then here:

when gf clicked
set [first item v] to [1] //item 1
set [second item v] to [2] //item 2
wait until <ready?> //put your own scripts for when it should so this
set [saver v] to <item (first item) of [list v]>
replace item (first item)  of [list v] with <item (second item) of [list v] >
replace item (second item) of [list v] with (saver)

- An algorithm that in a separate array will store the lengths of the items (e.g. how many characters in each array item string). The positions must match up, e.g.

Blab (4)

Blaba (5)

Bler (3)

when gf clicked
delete (all v) of [items v]
delete (all v) of [item lengths v]
set [i v] to [1]
add item scripts
repeat <length of [items v]>
insert <length of (item (i) of [items v])> into (last v) of [item lengths v]
change [i v] by [1]
end

- An algorithm that in a new array stores the same items but without any vowels in them


Can someone please help me with the scripting of these three algorithms?

Thanks in advance.

when gf clicked
delete (all v) of [vowels v]
delete (all v) of [items v]
delete (all v) of [edited items v]
add [a] to [vowels v]
add [e] to [vowels v]
add [i] to [vowels v]
add [o] to [vowels v]
add [u] to [vowels v]
add [whatever you want] to [items v]
set [i v] to [1] //both i, c and b are counters
set [b v] to [1]
set [c v] to [1]
repeat <length of [items v]> //putting the item into it's own array
delete (all v) of [word editor v]
repeat <length of (item (i) of [items v])>
insert (letter (b) of (item (i) of [items v])) at (last v) of [word editor v]
change [b v] by (1)
end
set [b v] to [1]
repeat <length of [word editor v]> //checking for vowels
repeat <length of [vowels v]> //if vowels, delete
if <<item (b) of [word editor v]> = <item (c) of [vowels v]>>
delete (b) of [items v]
end
change [c v] by (1)
change [b v] by (1)
end
set [c v] to [1] //resetting for next iteration
set [b v] to [1]
repeat <length of [word editor v]> //putting it back into the word
replace item (1 v) of [word editor v] with <join <item (1 v) of [word editor v]> <item (2 v) of [word editor v]>>
end
replace item (i) of [items v] with <item (1 v) of [word editor v]>
delete (all v) of [word editor v]
change [i v] by (1)
end

All of them should work, but the only one you might have problems with is the last one because that was the hardest and I didn't check if it works. But they all should.

Offline

 

#13 2012-12-09 07:35:01

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

That'll do, thanks for your help TorbyFork.

- Jed

Offline

 

#14 2012-12-09 15:29:42

bojo4evah
New Scratcher
Registered: 2012-12-08
Posts: 2

Re: A few things I need to do but what I'm very stuck on

Connor, please stop signing with my name.
Thank you.

- Jed.

Offline

 

#15 2012-12-09 16:56:03

MasterAnonymous
New Scratcher
Registered: 2012-12-08
Posts: 9

Re: A few things I need to do but what I'm very stuck on

No problem.
- Jed

Offline

 

Board footer