Download presentation
Presentation is loading. Please wait.
1
Silicon Valley Hacker Culture Introduction to Scratch (continued) UC Santa Cruz CMPS 10 – Introduction to Computer Science www.soe.ucsc.edu/classes/cmps010/Spring11 ejw@cs.ucsc.edu 16 May 2011
2
UC SANTA CRUZ Homework #4 To be posted online later today Two parts A skills-building part that builds up capability through a series of assignments An open-ended creative part Do something interesting using Scratch
3
UC SANTA CRUZ Silicon Valley Hacker Culture Going back to at least 1975 (and drawing inspiration from the 60s counter culture movement) Silicon Valley has hosted a culture of people hacking with technology Hacking – playing around with technology, in ways that sometimes were, and sometimes were not aligned with its original purpose Homebrew Computer Club (1975-1986) A club for early personal computer enthusiasts The Apple I computer emerged out of this club
4
UC SANTA CRUZ Silicon Valley Hacker Culture Today Hacker Dojo A community of engineers, artists, scientists, activists, entrepreneurs and other creative people centered around a co-working and social facility in Mountain View, CA. http://wiki.hackerdojo.com http://wiki.hackerdojo.com TechShop A membership-based workshop that provides members with access to tools and equipment, instruction, and a community of creative and supportive people so they can build the things they have always wanted to make. Computer-controller laser cutters, 3D printers, sewing machines, wood router, etc. California locations in Menlo Park & San Francisco, San Jose (summer 2011) http://techshop.ws/ http://techshop.ws/
5
UC SANTA CRUZ Maker Faire May 21-22, San Mateo Fairgrounds http://makerfaire.com/ Large show featuring many people who are creating novel things, many using computer controllers or software Inspiration to become a maker, someone who makes things (as opposed to someone who only consumes things) Extra credit deal: Go to Maker Faire Submit your ticket stub, along with a 3-4 paragraph description of what you liked and didn’t like about the show Due end-of-day, day of the final exam. Up to 10 extra credit exam points
6
UC SANTA CRUZ Sprites Sprites are anything visual you see on screen. Each Sprite has an associated block of program code. Box of available sprites On-screen sprite
7
UC SANTA CRUZ Scripts Clicking on a sprite brings up its associated code (middle pane) Script pane (code pane) This code controls how this sprite moves
8
UC SANTA CRUZ How to program Drag and drop code blocks into code pane Can be free floating, or connect to other sequences of code Can also select and move code from code pane to remove Double-click on code block to execute – you’ll see results in the upper right window
9
UC SANTA CRUZ Different kinds of statements Different buttons in the upper left window bring up different programming blocks Click a button here to bring up different code blocks here
10
UC SANTA CRUZ Conditionals in Scratch Scratch supports conditionals if condition then action if condition then action1 else action2 These are found in the Control tab Notice that the condition is a smooshed hexagon shape Conditions can be found under the operators tab (green) and the sensing tab (blue) Conditions are dragged and dropped into the hexagon shaped holes in a conditional
11
UC SANTA CRUZ Example of a conditional: Collision detection Collision detection Use the “touching” condition, found on the Sensing tab Clicking on the black triangle brings up a pull-down menu Mouse-pointer is the arrow you move with the mouse Edge is the edge of the stage (white window in upper right of screen) Anything below this is the name of another sprite “Puffy” is the same of a sprite Example After the green flag is pressed, do forever Move forward 5 steps Turn two degrees If the sprite is touching another sprite named Puffy Move 20 steps backwards
12
UC SANTA CRUZ Example of a conditional: Key input Key input Use the “Key ___ pressed?” condition, found on the Sensing tab Clicking on the black triangle brings up a list of keys that can be detected Example After the green flag is pressed, do forever Move forward 5 steps Turn two degrees If the space bar is pressed Move backwards 20 steps
13
UC SANTA CRUZ Variables A variable is a named storage location for data Can use variables to remember things for later… E.g., remembering a random number … or for counting things E.g., a score, the number of times something happened, etc. To create a variable Click on “Make a variable” on the Variables tab Will ask you: For a name for the variable (pick a descriptive name) Whether the variable is for just one sprite, or for all sprites Example Variable named “random-number” Set variable to a specific value Change variable + or - by a specific change in value Is the variable visible in the stage window
14
UC SANTA CRUZ Variables example: high-low game Pick a random number between 1 and 100 Put the random number in the variable named random-number Repeat until the player’s answer is the same as the random number (the player guessed correctly) Ask the player to guess a number between 1 and 100 If the guess is less than the random number, say “Too low!” If the guess is greater than the random number, say “Too high!” If the guess is the same as the random number, then the “repeat until” loop will stop, and the program will reach here (the first statement after the repeat until loop). Say, “You guessed it!”
15
UC SANTA CRUZ Coordination between sprites: broadcast Sometimes you want one sprite to cause another sprite to do something This is accomplished by the first sprite broadcasting a message The second sprite receives the message, and then does something Example When I see the space bar has been pressed… … I say “Hello!” hello message
16
UC SANTA CRUZ Pop quiz Open-notes, no computers, cellphones, etc. Questions are evenly weighted 1.Which type of switching (circuit or packet) does the Internet use? Packet switching 2.What technology did Tim Berners-Lee invent so that every computer could display internet-hosted documents? HTML Also acceptable: Web browser 3.What technology did Tim Berners-Lee invent so that every internet resource has a human-friendly name? URL 4.PHP is an example of a language that runs inside of what? PHP runs inside a web browser. Also acceptable: HTML (PHP is a programming language with statements interspersed among HTML elements) 5.What is a web application? A software application that runs inside a web server (and also has some code running inside a web browser) 6.Give an example of a Web 2.0 web site Many possibilities: Facebook, Google Maps, the Scratch website, YouTube, etc.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.