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

#1 2011-11-18 17:10:44

David5
New Scratcher
Registered: 2011-11-18
Posts: 3

Help me please

This was my assignment and also I saw the same question which posted in here. I tried to do it myself and the explanation of many replies, but I could not do it because I am a beginner about scratch and also my english is really bad  sad  Actually the due date of this assignment passed a week ago. I think something which is associated with this assignment(e.g. making table, breaking down a string etc) could be on the final exam, so I want to know how to do it. But as I mentioned before it is really hard to understand by writing or just hint to me. So ... If possible, please show me the pictures about it or upload the project. Then I will be so happy!

I hope you guys understand my horrible english. and please help me out

In this assignment you will be writing programs to manage tables containing league standings in a football league.  These are similar to the league tables you see in the paper all the time for the CIS, CFL, NFL, and other leagues.

The table will be stored in 6 lists:

a list with the team names
a list with the number of wins for each team
a list with the number of losses for each team
a list with the total number of points scored for each team
a list with the total number of points scored against each team
a list with the total number of points earned in the standings (2 points for each win)
These lists correspond to one another in the sense that the data for team i will be the i-th element of each list.  For example, if Layabouts is the third element of the team names list, their number of wins will be the third element of the number of wins list, their number of losses the third element of the number of losses list, and so on across all of the lists.

For the assignment you are to write scripts as described below.

Part 1 – Getting Scores into the Table

First, initialize the lists above, entering your team names in the first list, and 0’s for all the elements of the other lists.  Your next task is to write a script to enter scores into the table.  This will be done by a script attached to a sprite representing the league statistician.  When the sprite is clicked, the user is asked for a new score.  This is entered as a string such as “Layabouts 23 Luddites 14”.  The winning team and score will always come first, then the losing team and score.  You can assume that the names and scores will be separated by exactly one blank character, and that there will be no blank at the end or beginning of the string.  When presented with this string, the script must

add 1 to the Layabouts number of wins
add 1 to the Luddites number of losses
add 23 to the Layabouts total number of points scored for
add 23 to the Luddites total number of points scored against
add 14 to the Layabouts total number of points scored against
add 14 to the Luddites total number of points scored for
add 2 to the Layabouts total number of points earned
You may want to create helper scripts to do things like breaking out the next word from a string, and/or to find the position of a team in the table and/or to help you initialize the table. [60 marks]

Part 2 – Getting Information Out of the Table

Each team will have its own sprite (hopefully one appropriate to the team name) that, when clicked, will find out information about that team from the table.  The sprite will provide two kinds of information:

the team’s ranking, 1st, 2nd, 3rd, etc., in terms of number of points in the standings [15 marks]
how many points behind the leader the team is (this will be 0 if the team is in first place) [15 marks]
The sprite should say this information in a speech bubble.

You should test your scripts in both Part 1 and Part 2 on a league with at least 4 teams.  Use your imagination in the design of the team names, and the look and feel of the sprites and the stage.  Add comments to your scripts to label the important steps and to explain what each script is meant to do. [10 marks]

Offline

 

#2 2011-11-18 17:23:20

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Help me please

Sorry, as this is a school assignment I'm reluctant to help you. I'm sure your teacher won't mind getting you on the right track if you explain to him that you're stuck though.
And by the way, I don't know why say you're English is bad when it's not!  smile


Why

Offline

 

#3 2011-11-19 03:25:38

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Help me please

is this a school assignment or do you just want to know how to do it in case it comes up in your test


http://i.imgur.com/1QqnHxQ.png

Offline

 

#4 2011-11-19 08:25:55

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Help me please

The idea is to loop through all the items of a variable and break them apart by spaces.  Each part of the variable should be put in a list.  So the script should do this:

string = "Layabouts 23 Luddites 14"
repeat(length of string)
{
     if(letter(counter) of string== " ")
     {
          begin adding to the next list
     }
     else
     {
          add the current item of the list
     }
}

I'm hesitant to give you the exact code, but I hope that, by outlining what you have to do, you'll be able to crack it yourself.  I don't know how old you are or what grade you're in, but it is far more complex than any Scratch assignment I've seen people asking about on Scratch.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2011-11-19 20:14:08

David5
New Scratcher
Registered: 2011-11-18
Posts: 3

Re: Help me please

I wish you just give me a code if you do not mind. I tried to follow your explanation, but I failed. I cannot follow this part. <if(letter(counter) of string== " ")>. I could not put the (letter (counter) of string) in if. Its shape is < > , but the letter's shape is ( ). Do you understand what i am saying? Also no idea about " " part either  sad  Hope you show me the code or pictures.

Offline

 

#6 2011-11-19 20:18:51

David5
New Scratcher
Registered: 2011-11-18
Posts: 3

Re: Help me please

TRocket// I want to know how to do it exactly cause it could be on the final exam. It was an assignment but its due date already passed. I  wanna prepare the final at least since I do not have really good mark in assignment part so far. Wish help me out  smile

Offline

 

#7 2011-11-19 20:50:03

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Help me please

Well, seeing as it isn't a school assignment, and you genuinely want the knowledge, I've included the code below, with comments (shown by "//").  "list" is the list that the variable named "variable" will be broken up into.

Code:

set [i] to (0)
delete (all) of [list]
add () to [list]
repeat (length of variable)     // loop through the whole variable
{
     change [i] by (1)
     if(letter (i) of (variable) == [ ] )     // if the current letter is a space
     {
          add () to [list]           // add a new empty item to the list
     }
     else
     {
          replace item (last) of [list] with  (join ((item (last) of [list]) with (letter (i) of (variable)))
          // replace the last item on the list with: itself joined to the  letter
     }
}

Last edited by MoreGamesNow (2011-11-19 20:50:49)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer