Code Combat.

Slides:



Advertisements
Similar presentations
Techniques for Solving Logic Puzzles. Logic Puzzles Logic puzzles operate using deductive logic. Logic puzzles operate using deductive logic. A well-designed.
Advertisements

Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Variables Conditionals Loops The concept of Iteration Two types of loops: While For When do we use them? Iteration in the context of computer graphics.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Algebra Problems… Solutions Algebra Problems… Solutions © 2007 Herbert I. Gross Set 4 By Herb I. Gross and Richard A. Medeiros next.
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
1 9/26/08CS150 Introduction to Computer Science 1 Logical Operators and if/else statement.
Python (yay!) November 16, Unit 7. Recap We can store values in variables using an assignment statement >>>x = We can get input from the user using.
Decisions in Python elif. A new keyword elif A contraction of “else if” Used to tie two if statements (or more) together into one structure Syntax – elif,
1 9/28/07CS150 Introduction to Computer Science 1 Logical Operators and if/else statement.
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Programming – Touch Sensors Intro to Robotics. The Limit Switch When designing robotic arms there is always the chance the arm will move too far up or.
Algebra Problems… Solutions
Solving Equations: The Addition and Multiplication Properties
Introduction While it may not be efficient to write out the justification for each step when solving equations, it is important to remember that the properties.
Solving Equations with Variables on Both Sides
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
9-1 Solving 3 by 3 Systems Day 1. Umm… did she say 3 by 3?? Just like the 2 by 2 systems, we will solve the 3 by 3 systems. How many methods did we choose.
Week 5 - Wednesday.  What did we talk about last time?  Exam 1!  And before that?  Review!  And before that?  if and switch statements.
Engineering 1020 Introduction to Programming Peter King Winter 2010.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Semester Review. As we have discussed, Friday we will have in class time for you to work on a program, this program will come with instructions and you.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Selection Statements. Introduction Today we learn more about learn to make decisions in Turing ▫Nested if statements, ▫case statements.
Using the Pythagorean Theorem Sarah Katko ICL 7062.
Solving Linear Equations. Example 1 It’s obvious what the answer is. However, we need to start with the basics and work our way up because we need to.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
TAKS Tutorial Test-Taking Strategies. Remember that the TAKS test is untimed! That gives you plenty of time to do this first strategy! Look at the ENTIRE.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Using the Eclipse Debugger Extra Help Session (Christina Aiello)
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Microsoft® Small Basic Conditions and Loops Estimated time to complete this lesson: 2 hours.
Loops Brent M. Dingle Texas A&M University Chapter 6 – Section 6.3 Multiway Branches (and some from Mastering Turbo Pascal 5.5, 3 rd Edition by Tom Swan)
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
What to do when a test fails
Statistics 2. Tree Diagrams
Mr F’s Maths Notes Number 10. Surds.
WELCOME to….. The If Statement.
IF statements.
Stats and Probability 2. Tree Diagrams
Solving Systems Using Substitution
While Loops in Python.
Let's Race! Typing on the Home Row
Introduction While it may not be efficient to write out the justification for each step when solving equations, it is important to remember that the properties.
Logical Operators, Boolean Data Types
Introduction to Equations Cronnelly
Code Combat.
Selection CIS 40 – Introduction to Programming in Python
Conditions and Ifs BIS1523 – Lecture 8.
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Solving Systems of equations
Stats and Probability 2. Tree Diagrams
Coding Concepts (Basics)
92 4 = Not many of us know off the top of our head how many groups of 4 there are in the number 92.
Testing and Repetition
Solving Linear Equations
SE1H421 Procedural Programming LECTURE 4 Operators & Conditionals (1)
if-else Structures Principles of Engineering
Using Decision Structures
Programming In Lesson 4.
Solving Linear Equations
How to Score More Than 50 Points in Desert Sons SPG
While Loops in Python.
CIS125GA Week 4 Logical Beginnings
Solving Systems of equations
Solving Linear Equations
Presentation transcript:

Code Combat

The Sarven Desert We made it to the next world! Wahoo!

1: The Mighty Sand Yak

1: The Mighty Sand Yak

1: The Mighty Sand Yak We will use the Sense Stone again

1: The Mighty Sand Yak By adding 10 to your x position, you are moving right along the x axis

1: The Mighty Sand Yak These lines set the x, y values which we will move to. Our x value is set to our current x value plus 10. This means we will move to right by 10 units. Note that y is set to our current y value. This essentially means we won’t move up or down.

1: The Mighty Sand Yak This is the line that will actually move our hero. The hero will move to the x, y coordinates we set in the lines above.

1: The Mighty Sand Yak

1: The Mighty Sand Yak ** **Don’t forget to establish a variable for yak!**

2: Oasis

2: Oasis The ask for this is pretty straightforward - can you use pos.x and pos.y?

2: Oasis NOTE: the and operator

Review: Boolean Logic True/False logic Used in conditional expressions, as in: If a condition is true, do this

Boolean Operators You can combine conditions using the fundamental operators And, Or and Not Different rules determine what the combined conditions will evaluate to - either True or False http://www.i-programmer.info/babbages-bag/235-logic-logic-everything-is-logic.html

Boolean Operators And Operator Or Operator Not Operator and or not

Review: If statements If statements operate off of Boolean Logic. An if statement will run a sequence of code only if a condition is true With and/or operators, the sequence will be run based on the boolean values of both conditions

And Operator condition1 and condition2 == Boolean Value An expression that uses an and operator will evaluate to a boolean value based on the boolean values of each condition within the expression

And Operator True and True == True True and False == False False and True == False False and False == False If one or more condition within an and expression is false, the entire expression evaluates to false

Or Operator condition1 or condition2 == Boolean Value An expression that uses an or operator will evaluate to a boolean value based on the boolean values of each condition within the expression

Or Operator True or True == True True or False == True False or True == True False or False == False If one or more condition within an and expression is true, the entire expression evaluates to true

And Operator condition1 and condition2 == Boolean Value A not operator works a little differently. Not operators take one condition and evaluate to the opposite of that condition.

Not Operator not True == False not False == True

2: Oasis So the code sequence for this if statement will run if and only if both there is an enemy and the distance to that enemy is less than 10 Take a moment to explain why this won’t work

2: Oasis

2: Oasis Reminder: By subtracting 10 from your x position, you are moving left along the x axis

2: Oasis This might seem like the simplest solution - define x and y for each situation and move. However this is not the best solution! Take a moment to explain why this won’t work

2: Oasis This code is better. Less lines == more efficient The variables are established before the loop. The loop then starts with a move and then reassigns x according to your hero’s current situation.

2: Oasis NOTE: += means add following to current value, -= means subtract following from current value

2: Oasis

3: Sarven Road

3: Sarven Road

3: Sarven Road Reminder: the and operator Note: You could also define x and y before loop and use the ++ or += operators

3: Sarven Road Note: You could also define x and y before loop and use the ++ or += operators

4: Thunderhooves

4: Thunderhooves

4: Thunderhooves

4: Thunderhooves

4: Thunderhooves

4: Thunderhooves

4: Thunderhooves

5: Medical Attention

5: Medical Attention

5: Medical Attention

5: Medical Attention

5: Medical Attention This is my first try - pretty basic code we have seen before. Check first that your health isn’t too low, then sequence through cleaving and bashing

No luck! As the level warns, you’ll need to “fight hard” 5: Medical Attention No luck! As the level warns, you’ll need to “fight hard”

I found a shield that adds a “bash” attack - let’s give that a try! 5: Medical Attention I found a shield that adds a “bash” attack - let’s give that a try!

5: Medical Attention Depending on how many coins you have, there are a multitude of helpful items you can try on your own! Feel free to branch out or try something different after you go ahead with the shield code.

Now let’s add bash in before attack 5: Medical Attention Now let’s add bash in before attack

With this additional code, we have success! 5: Medical Attention With this additional code, we have success!

Interested in Dueling?

Navigate Back... Head back to the forest and find the Dueling Grounds “level”

Duel This is a practice on what it will be like to attack one-on-one against other competitors

Duel Here is the code you start with. You can fill it with some of the attack lines we have used previously. But what if you leave the loop out?

Duel This is our basic nested if statement attack code. However without the loop, this if/else if/else sequence will only be run once

How are you going to get the upper hand? Buy new stuff! Try lines out! Duel Here is my final code - but remember, as the duels continue, you will be designing your own code. How are you going to get the upper hand? Buy new stuff! Try lines out!

Duel After you win, click Rank My Game

Duel