mystery song
block to create a game.There are command block versions of two blocks you've already seen:
if then else
and the command if else
.
In Unit 1 Lab 6 Activity 2: L33t Text, you used to decide what the computer should report. You can use the command version to decide what the computer should do. Like the reporter version, the command
if else
block takes three inputs:
The command block, however, performs a set of commands depending on the result of the condition rather than reporting an output.
I don't disagree with anything you are saying in principle, but in this unit, we are trying to begin preparing them for Snap! as it exists in the wild, and that doesn't have ask
. We could go back and make sure they were told that everything they've learned that isn't a primitive isn't a primitive, but instead, we've opted for the to-be-created end-of-unit blocks list that will make the distinction. --MF, 3/6/22
In Unit 1 Lab 7 Activity 3: Collecting Your Data, you used to ask the user a question and report the user's response. To use Snap!'s built-in version, first use the command
to ask the user your question and then use the reporter
to access the answer stored the last time
ask and wait
was run.
There is an example embedded in the fourth hint. You are looking for something here too? --MF, 3/7/22
Is your project missing the ,
and
blocks?
There was a mistake! If these blocks are not in your project, go back to the first activity, press and hold the shift key while you reload the page, open the project in exercise #2, choose "Save As..." from the Snap! File menu, and save with a new name (so you don't lose your prior work).
Here you talk about SAY, but in the third hint the picture uses SAY FOR __ SECS. You should decide which. I think plain SAY is fine for this purpose. --bh 3/3/22
Agreed. To resolve next year. --MF, 3/6/22
You can use ask and wait
to ask the user a question (and store their response), and you can use to tell the user something that isn't a question.
The script for your game needs to do three things:
Use the if else
command block to test whether the guess is correct with a predicate like . If the guess is correct, then use
say
to tell the user they are correct; if it's not correct, then use say
to tell them that.
Try making code that's something like this:
Cut for now. I believe some of this was here at Dan's request, so I'm not cutting without more attention. --MF, 3/6/22
I'm not sure what you expect them to do here. If the idea is that they nest another IF ELSE in the else clause of the first one, that's a whole new idea, and one students find hard, not appropriate for an ITIT. I'm not sure this is salvageable, but it might be with a serious rewriting. --bh 3/3/22
I assumed it was just using an or. Maybe should explicitly suggest using the or block. You can also say "to allow the user to be correct with different variations on the song title", which is different from having to implement a spell checker (a quite difficult task, as 61A students will attest this semester!). -pf 3/3/22
I made this a TIF for now. (And then I cut it.) ;) --MF, 3/6/22
if else
block and predicate (hexagonal testing function) to allow the user to be correct even with a different variation of the spelling of the song. For example, you might want the game to approve either "The Alphabet Song" or "Alphabet."random
together with if else
. I like this idea, but I don't see a way to do more than two mystery songs with the blocks they know at this point (e.g., not global or script variables---globals are taught later in this lab). Am I missing anything? --MF, 2/10/22
I don't understand the question. How can they do even two songs? Presumably by putting the two song scripts in the slots of the IF ELSE. Well, if they can do that, they can nest two IF ELSE blocks, as in the ITIT above, and that gives them three slots for songs, etc. --bh 3/3/22
I also don't know how to do this without using some variable to track which song they ended up picking and asking about, since we need that to happen before the if/else that checks the answer. Ah okay well I guess you can have the if condition be a random number between 1 and length of songs, and then inside the if/else clause, it plays the song and asks them for their guess, but then I bet they'll end up repeating all that ask-code and it'll be gross. I feel like doing this cleanly is hard. --pf 3/3/22
if else
to control what the game says to the player.
I cant find the ask block :( I think it has to be in the song player project blocks microworld. -pf 3/3/22
This needs to be fixed in all XML files, but for now, I fixed the starter file and added this takeNote box to help anyone who has already saved the problem project. --MF, 3/6/22
I now realize it's missing the "say" block(s). I also think it’d be nice to have the “When flag clicked” block so a student can share a code-less version of the project (otherwise you can see the answer in the code on the left). -pf 3/6/22