Strings, Puzzle App I CSE 120 Winter 2018

Slides:



Advertisements
Similar presentations
Hand Crafting your own program By Eric Davis for CS103.
Advertisements

How to Make a Web Page: A Crash Course in HTML programming.
Guide to Programming with Python Chapter Two Basic data types, Variables, and Simple I/O: The Useless Trivia Program.
Introduction to Python Lecture 1. CS 484 – Artificial Intelligence2 Big Picture Language Features Python is interpreted Not compiled Object-oriented language.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Field Trip #26 Create a Find a Word Puzzle in Java By Keith Lynn.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
COP Structures Instructor: Diego Rivera-Gutierrez I’m back baby!
Chapter 4 Introduction to Classes, Objects, Methods and strings
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
1 Cannon_Chapter9 Strings and the string Class. 2 Overview  Standards for Strings  String Declarations and Assignment  I/O with string Variables 
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 More details and explanation …
Programming with Microsoft Visual Basic th Edition
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
C++ Programming Lecture 14 Arrays – Part I The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
1 Project 7: Looping. Project 7 For this project you will produce two Java programs. The requirements for each program will be described separately on.
Arrays Chapter 7.
CS 106A, Lecture 27 Final Exam Review 1
Nested Loops & Arrays CSE 120 Spring 2017
Unit 2 Technology Systems
Event-Driven Programming
Basic Input and Output CSE 120 Spring 2017
CSE 220 – C Programming C Fundamentals.
Topic: Conditional Statements – Part 1
Developing an App CSE 120 Spring 2017
Functions in Processing CSE 120 Spring 2017
Lightbot and Functions CSE 120 Winter 2017
Introduction to Scripting
JavaScript Syntax and Semantics
Arrays in C.
Intro to PHP & Variables
Algorithmic Complexity CSE 120 Winter 2018
Engineering Innovation Center
Mid-Quarter Review CSE 120 Winter 2018
Functions in Processing CSE 120 Winter 2018
HTML Forms and User Input
Puzzle App II CSE 120 Winter 2018
Basic Input and Output CSE 120 Winter 2018
Variables & Datatypes CSE 120 Winter 2018
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
Variables and Arithmetic Operations
Processing and Drawing CSE 120 Winter 2018
Mid-Quarter Review CSE 120 Spring 2017
Expressions & Control Flow CSE 120 Winter 2018
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Developing an App II CSE 120 Spring 2017
Variables & Datatypes CSE 120 Spring 2017
Lesson 6: User Input and Strings
Lightbot and Functions CSE 120 Winter 2018
Chapter 6 Event-Driven Pages
Nested Loops, Arrays CSE 120 Winter 2018
Introduction to TouchDevelop
IPC144 Introduction to Programming Using C Week 3 – Lesson 2
A look at Small basic The Text Window 2017.
Algorithms CSE 120 Winter 2018 Instructor: Teaching Assistants:
Basic Input and Output CSE 120 Winter 2019
Variables & Datatypes CSE 120 Winter 2019
CS360 Client/Server Programming Using Java
Functions continued.
Arrays CSE 120 Winter 2019 Instructor: Teaching Assistants:
Suggested self-checks: Section 7.11 #1-11
Introduction to Computer Science
Chapter 7 Event-Driven Pages
Buttons & Boards CSE 120 Winter 2019
IPC144 Introduction to Programming Using C Week 5 – Lesson 1
CMPT 120 Lecture 4 – Unit 1 – Chatbots
Week 7 - Monday CS 121.
Day 1: Getting Started with Microsoft Excel 2010
Presentation transcript:

Strings, Puzzle App I CSE 120 Winter 2018 Instructor: Teaching Assistants: Justin Hsia Anupam Gupta, Cheng Ni, Eugene Oh, Sam Wolfson, Sophie Tian, Teagan Horkan Going beyond Pokemon Go: preparing for an augmented reality future “Franzi argues that AR is essentially different than other kinds of technology we interact with because of its immersive potential. ‘It is directly sitting between your perception of reality and your actions in the physical world,’ she says. "What can those apps do once they have the ability to change your view of the physical world? ...If you're driving, an application might block your view of pedestrians crossing the street," Franzi says, ‘or they might startle you with scurrying spiders.’ ” http://www.cbc.ca/radio/spark/going-beyond-pokemon-go- preparing-for-an-augmented-reality-future-1.4406069 You can use Snapchat to switch faces with your dog. The Sephora app lets you see how different colours of eye shadow will look. Ikea has an app that lets you place virtual furniture around your house to see how it will look before you buy. And, of course, there's Pokemon Go. Jet fighters have used heads-up displays in their helmets for decades, and Boeing tried using displays that overlaid wiring diagrams to help technicians in the early 90's. Today: Google Glass, Microsoft HoloLens

Administrivia Assignments: Controlling Elli due tonight before 11:59 pm (2/12) Color Filters due before section tomorrow (2/13) Reading Check 6 due before section Thursday (2/15) Word Guessing due Friday (2/16) Living Computers Museum Report due next Tuesday (2/20) Programming assignments: checked off OR submitted We highly recommend getting checked off “Big Ideas” lecture on Friday: Artificial Intelligence

Strings A string is a string of characters (0 or more) Strings cannot be modified, but string variables can be reassigned Individual characters can be accessed (not modified), numbered from left-to-right starting at 0 String literal: an unnamed string specified between double-quotes e.g. "hello", "!@#$%^&*()_+ ?~", "xoxo <3" "" is known as the empty string (0 characters in it)

Using Strings Declaration: String str; Assignment: str = "hello"; Get character using str.charAt(i) Get length using str.length() Concatenation: join strings using ‘+’ operator e.g. "hi " + "there" gives you "hi there" Conversion to string usually occurs implicitly Can also explicitly use str()

Strings vs. Arrays Strings are sort of like arrays of characters: Declare Initialize Get element Get length

Example: Recording User Input keyPressed() lets you read user input 1 character at a time Use a String variable to “store” Add/append new characters using concatenation

Example: Recording User Input keyPressed() lets you read user input 1 character at a time Use a String variable to “store” Add/append new characters using concatenation String input = ""; void draw() { } void keyPressed() { input = input + str(key); println("input = " + input);

Word Guessing Learn to use text input & output Player 1 enters a secret phrase Player 2 tries to guess the secret phrase Game tells you how many letters correct & # of attempts

Outline The Game Design Phase Coding Phase

15 Puzzle Sliding puzzle that consists of numbered square tiles in random order with one tile missing Also known as “Mystic Square” We will program just the game mechanics Won’t do winning condition, since not all game states are solvable

App Mechanics Tiles numbered 1-15 are shown on game board One “open” or “empty” square Clicking a tile next to the empty square will “slide” that tile into the empty space Clicking other tiles has no effect Clicking outside of the game board has no effect Include a Reset button to return the game board to its initial state

Outline The Game Design Phase Coding Phase

Design the Layout

Coding Decisions How to represent the state of the game board? How to implement the “slide” functionality? How to respond to clicks?

Outline The Game Design Phase Coding Phase

Create the Reset Button

Create the Tile Layout