Presentation is loading. Please wait.

Presentation is loading. Please wait.

UBC 2016 Why Coding?.

Similar presentations


Presentation on theme: "UBC 2016 Why Coding?."— Presentation transcript:

1 UBC 2016 Why Coding?

2 About Me Cam Joyce Johnston Heights joyce_c@surreyschools.ca
Teach Math and CS Great wedge for introductions ADST/Math Curriculum writer Computing Science Computer Programming

3

4

5 Muddy City

6 Computational Thinking
Solving this problem is great! Practice solving problems like this helps develop computational thinking Helps prepare students for more formalized CS education It would be even better if: We could solve ALL analogous problems We could prove our method correct/optimal We could solve the problem as efficiently as possible

7 Power Lines

8 290 This is the cheapest solution:
While a house is not connected to the electricity Select the cheapest connection that has not been used If it does not connect two houses that are already connected to each other (redundant), use it Mark this path as “used” so it will not be considered This is the cheapest solution: 290

9 Can you find the equation?

10 Computational Thinking (CSTA)
Computational thinking (CT) is a problem-solving process that includes (but is not limited to)the following characteristics: Formulating problems in a way that enables us to use a computer and other tools to help solve them. Logically organizing and analyzing data Representing data through abstractions such as models and simulations Automating solutions through algorithmic thinking (a series of ordered steps) Identifying, analyzing, and implementing possible solutions with the goal of achieving the most efficient and effective combination of steps and resources Generalizing and transferring this problem solving process to a wide variety of problems These skills are supported and enhanced by a number of dispositions or attitudes that are essential dimensions of CT. These dispositions or attitudes include: Confidence in dealing with complexity Persistence in working with difficult problems Tolerance for ambiguity The ability to deal with open ended problems The ability to communicate and work with others to achieve a common goal or solution

11 Why Coding? Computational Thinking without programming is like
A chef without knives A plumber without pipes A pilot without a plane Computational Thinking without programming is like knowing the solution without executing it. Programming is a tool students should gain exposure to

12 Block Coding (Drag and Drop)
Snap Scratch

13 I apologize in advance…

14 mrjoyce.wordpress.com Download the skeleton project
You may also want to download the slides in case you want to work ahead/need to catch up Open in Greenfoot There are two projects posted The skeleton we’ll play with A completed skeleton with the basic code complete

15 Task #0 I want the main character to start the game at the bottom of the screen Currently I have to manually put the character in Open the Space file Find the Space() constructor A constructor builds an object Find this line of code mainCharacter = new Ship(); Below it add this line of code addObject( mainCharacter, getWidth()/2, getHeight() – 25);

16 Task #1 Locate the shoot() method of the Ship Build a new Laser
ShipLaser laser = new ShipLaser(); Make it point in the same direction as the Ship Laser.setRotation( getRotation() ); Add it to the game getWorld().addObject( laser, getX(), getY() ); Create a sound effect GreenfootSound soundfx = new GreenfootSound("Laser.mp3"); Play the Sound effect soundfx.play(); public void shoot() { laser.setRotation( getRotation() ); getWorld().addObject(laser, getX(), getY()); }

17

18 Task #2 – Logic/Branching
Making the ship move For now, let’s make the ship move left/right Locate the processKeys() method in the Ship file Here’s the code for left, can you figure out how to move right? public void processKeys() { if(Greenfoot.isKeyDown(“left”)) setLocation(getX() – 3, getY()); } //add code for moving right here

19 Task #3 – Variables/Data
private int speed; public Ship() { speed = 3; } public int getSpeed() return speed; public void setSpeed(int newSpeed) speed = newSpeed;

20 Task #3 – Variables/Data
Improving our movement code public void processKeys() { if(Greenfoot.isKeyDown(“left”)) setLocation(getX() – speed, getY()); }

21

22 Task #4 - Repetition Locate the burst() method of the Ship
Add the following code (shown in yellow) public void burst() { int amount = 20; double change = 180.0/(amount+1); double angle = getRotation() change; addFireBall(angle); bursts = bursts - 1; updateBurstBoard(-1); }

23 Task #4 - Repetition Make another update (shown in yellow)
public void burst() { int amount = 20; double change = 180.0/(amount+1); double angle = getRotation() change; for(int count = 0; count < amount; count++) addFireBall(angle); } bursts = bursts - 1; updateBurstBoard(-1);

24 Task #4 - Repetition { int amount = 20;
Make another update (shown in yellow) public void burst() { int amount = 20; double change = 180.0/(amount+1); double angle = getRotation() change; for(int count = 0; count < amount; count++) addFireBall(angle); angle = angle + change; } bursts = bursts - 1; updateBurstBoard(-1);

25 Greenfoot API

26 Coding Challenges Change how fast the Aliens shoot
Change how fast Projectiles move Change the points awards when an Alien is removed from the game Play the sound effect “Die.mp3” when an Alien is removed from the game Play the sound effect “Hit.mp3” when the Ship collides with an AlienLaser Change the amount of Fireballs launched in a burst Change the spawnPU rate of Space Change the amount of aliens in Space Complete the launchHomingMissile method of the Ship Edit code and predict its consequences, run the game to see if you’re right Ex. What if you remove the lines: triggerReleased = false; from the Ship


Download ppt "UBC 2016 Why Coding?."

Similar presentations


Ads by Google