Asking User for an Answer Alice 3 Tricks in Mini Trivia (2/4)

Slides:



Advertisements
Similar presentations
SCRATCH Lesson Two – Interactive Concepts Using Sensing, Operators, and Variables.
Advertisements

Alice Learning to program: Part Four Creating Sounds, Making Billboards, Fun with 3-D Text, New Events, and Rotating Objects by Ruthie Tucker and Jenna.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
How Tall Are You? Introducing Functions By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made June 2014 by.
Using Functions in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University July 2008.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Using Functions in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University July 2008.
Wizard Game: Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Creating Functions Deborah Nelson Duke University Professor Susan Rodger July 22, 2008.
1 Quiz Template: Click on the match By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 2009.
Shorter of two objects and changing color Functions, events and setting the color Susan Rodger, Duke University June 2008.
Animated Charting Using the Alice Bar Chart Template World By Elizabeth Liang under the direction of Professor Susan Rodger Duke University December 2010.
Checking for Collisions Ellen Yuan Under the direction of Professor Susan Rodger at Duke University June 2014.
Line up By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Branching and Looping Examples, cont’d. Remember the generic triple jump world…
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Shorter of two objects and changing color V2 Functions, events and setting the color in sequence and randomly This is a modification of the Changing Color.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Camera Control: Learning to Use the Camera in Alice By Henry Qin, edited by Jenna Hayes under the direction of Professor Susan Rodger Duke University,
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
A Simple Quiz: Ask User Functions. By Lana Dyck under the direction of Professor Susan Rodger Duke University June 2009, added Part 2 July 2011.
Making a Timer in Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
1 ball, 2 ball, red ball, blue ball By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Can I get your number? By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Making Billboards By Deborah Nelson Duke University, Under the direction of Professor Susan Rodger, July 14, 2008.
1 Quiz Template: Using the ‘ask user’ functions By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 2009.
Balancing the scales: Inequalities By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Nonvisual Arrays by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Simple Collision Detection By David Yan Under the direction of Professor Susan Rodger and Chari Distler Duke University, June 2015.
How Tall Are You? Introducing Functions for Alice 3 By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made.
Making Billboards By Deborah Nelson Duke University, Under the direction of Professor Susan Rodger, July 14, 2008.
DAY 4. MAKING SOMETHING ‘JUMP’ Simple! Move it a certain amount ‘up’ Glide back to your original spot.
Under the direction of Susan Rodger
About the Mini Trivia Challenge
By Melissa Dalis Professor Susan Rodger Duke University June 2011
A Simple Quiz for Alice 3.2:
Comparing objects and changing color
Making a Timer This is an modification of the July 2008 timer tutorial by Jenna Hayes By Natalie Huffman Under the direction of Susan Rodger Duke University.
Importing a PPT page as Billboard Alice 3 Tricks in Mini Trivia (3/4)
Changing Color, Using Text Objects, and Random Selection in Alice
Let's Race! Typing on the Home Row
Engineering Innovation Center
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Skater World: Part Three
Memory Matching Challenge
Building a Scorekeeper Alice 3 Tricks in Mini Trivia (1/4)
Making Procedural Methods
A Simple Quiz for Alice 3.2:
Introduction to TouchDevelop
And and or…and RANDOMNESS
Checking for Collisions: Using Functions in Alice
Using Functions
Restricting an Event with a Conditional
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events
How Tall Are You? Introducing Functions
Professor Susan Rodger
Relational Expressions
Professor Susan Rodger
Primary School Computing
under the direction of Professor Susan Rodger
Restricting Events Creating Conditional Events in Alice By Henry Qin
Presentation transcript:

Asking User for an Answer Alice 3 Tricks in Mini Trivia (2/4) By Vicki Zhang Duke University Under the direction of Professor Susan Rodger June 2017

About the Mini Trivia Challenge Mini Trivia is a four-question game created by Vicki Zhang. The author explains four useful topics involved in separate tutorials: scorekeeper asking user for an answer billboard multi-layered object clicking This tutorial explains how to ask user for an answer. Start by downloading Mini Trivia_Challenge 2 Ask User_Start

Background Each object, when clicked on, will solicit an answer from the user. The hammer asks for a true/false boolean; Dory asks for a letter string; Squirrel asks for an integer number.

Background The palm tree does something a bit different. We’ll talk about it in Tutorial #4, Multi-layered Object Clicking.

To get started In Scene, you will see all the main procedures that we will be tweaking.

Go to questionA Drag in getBooleanFromUser to replace the “true”, and set the custom string value to “Decide:”. This value here denotes the text displayed when the question is prompted.

Question A Completed! You could run the world and click on the hammer to check out the effect. You could see that, now, the score will change based on user (your) response!

Go to questionC In question A, the if/else block was built for you. Thus, you just needed to fill in the condition to make it work. In question C, let’s build the if/else block from scratch. Goal: The squirrel will ask the user when Duke was founded. If the answer is correct, i.e. answer == 1838, then we add 20 points; else, we deduct 10 points.

Building Question C First, drag in an if block from the bottom of the screen, and select “true” as a placeholder. Click on “true” for the drop-down list and select relational (whole number) and then “==”. Then select 0 and 0.

Your if statement now looks like above Your if statement now looks like above. We will now replace the zeros with meaningful selections. Find the getIntegerFromUser function from DukeSquirrel and drag onto the first 0. Type in “Your response:” for custom TextString.

Your if statement should now look like above. Now, click on the 0 on the right side, and select custom whole number. Type in 1838 (the correct answer for Duke’s establishment). Done ↓

Filling out the if/else block So far, we have constructed the condition of the if statement. If the condition is met, we will add 20 points. Else, we will deduct 10 points. Find this.score as shown on the right, and we will employ some of its procedures created for you.

Adding/Reducing Points For the IF half Drag in addScore from the procedures  custom whole number  20. For the ELSE half Drag in reduceScore from the procedures custom whole number  10.

Add More Excitement If so inclined, you could add extra effects for getting the answer (in)correct. Mine is like this:

Finally, go to questionD Scroll all the way to the bottom. This is a multiple choice question, and asks the user to input a letter, which is a string. Therefore, click on the “true” in the if statement and select TextString Comparison – ??? contentEquals??? – and two “hello”s.

1. Drag getStringFromUser over to replace the first “hello.” 2. Select custom TextString and type: “Indicate your response with ONE CAPITALIZED letter” to avoid structural confusion. 3. Replace the second “hello” with one capitalized “B”. Question D

Done! Run the program and play around with it (even though you now know the answers). 