Chapter 5: Your Program Asks for Advice.

Similar documents
Week 8. Topic 2 Properties of Logarithms

Parametric Methods. Autoregressive (AR) Moving Average (MA) Autoregressive - Moving Average (ARMA) LO-2.5, P-13.3 to 13.4 (skip

6.6 The Marquardt Algorithm

Winnie flies again. Winnie s Song. hat. A big tall hat Ten long toes A black magic wand A long red nose. nose. She s Winnie Winnie the Witch.

_ J.. C C A 551NED. - n R ' ' t i :. t ; . b c c : : I I .., I AS IEC. r '2 5? 9

Language Processors F29LP2, Lecture 5

Optimization. x = 22 corresponds to local maximum by second derivative test

General Physics II. number of field lines/area. for whole surface: for continuous surface is a whole surface

10 Statistical Distributions Solutions

CIRCUITS AND ELECTRONICS. The Impedance Model

Neural Network Introduction. Hung-yi Lee

COMP 465: Data Mining More on PageRank

3.1 Magnetic Fields. Oersted and Ampere

What do you think I fought for at Omaha Beach? 1_1. My name is Phil - lip Spoon- er, and I ... "-- -. "a...,

For the percentage of full time students at RCC the symbols would be:

Rank One Update And the Google Matrix by Al Bernstein Signal Science, LLC

Chapter 7. Kleene s Theorem. 7.1 Kleene s Theorem. The following theorem is the most important and fundamental result in the theory of FA s:

Improper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:

Definition :- A shape has a line of symmetry if, when folded over the line. 1 line of symmetry 2 lines of symmetry

The graphs of Rational Functions

332:221 Principles of Electrical Engineering I Fall Hourly Exam 2 November 6, 2006

Lecture 11: Potential Gradient and Capacitor Review:

Part I: Study the theorem statement.

Homework 3 MAE 118C Problems 2, 5, 7, 10, 14, 15, 18, 23, 30, 31 from Chapter 5, Lamarsh & Baratta. The flux for a point source is:

Physics 604 Problem Set 1 Due Sept 16, 2010

Lecture 2e Orthogonal Complement (pages )

Name Ima Sample ASU ID

Applied Statistics Qualifier Examination

Chapter 6 Continuous Random Variables and Distributions

What else can you do?

Class Summary. be functions and f( D) , we define the composition of f with g, denoted g f by

Bob Brown Math 251 Calculus 1 Chapter 5, Section 4 1 CCBC Dundalk

Math Lecture 23

This chapter will show you. What you should already know. 1 Write down the value of each of the following. a 5 2

PLEASE DO NOT TURN THIS PAGE UNTIL INSTRUCTED TO DO SO THEN ENSURE THAT YOU HAVE THE CORRECT EXAM PAPER

Energy Dissipation Gravitational Potential Energy Power

IMA Preprint Series # 2202

ME306 Dynamics, Spring HW1 Solution Key. AB, where θ is the angle between the vectors A and B, the proof

The Number of Rows which Equal Certain Row

(1) It increases the break down potential of the surrounding medium so that more potential can be applied and hence more charge can be stored.

n f(x i ) x. i=1 In section 4.2, we defined the definite integral of f from x = a to x = b as n f(x i ) x; f(x) dx = lim i=1

AP Calculus AB Exam Review Sheet B - Session 1

Recursively Enumerable and Recursive. Languages

EECE 260 Electrical Circuits Prof. Mark Fowler

Fluids & Bernoulli s Equation. Group Problems 9

Continuous Charge Distributions

7.2 The Definite Integral

Physics 1502: Lecture 2 Today s Agenda

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

This immediately suggests an inverse-square law for a "piece" of current along the line.

Math 4318 : Real Analysis II Mid-Term Exam 1 14 February 2013

Previously. Extensions to backstepping controller designs. Tracking using backstepping Suppose we consider the general system

10. AREAS BETWEEN CURVES

π,π is the angle FROM a! TO b

Name Solutions to Test 3 November 8, 2017

M597K: Solution to Homework Assignment 7

Designing Information Devices and Systems I Discussion 8B

U>, and is negative. Electric Potential Energy

Bases for Vector Spaces

Chapter I Vector Analysis

Who is this Great Team? Nickname. Strangest Gift/Friend. Hometown. Best Teacher. Hobby. Travel Destination. 8 G People, Places & Possibilities

5.2 Exponent Properties Involving Quotients

MATH 573 FINAL EXAM. May 30, 2007

ITI Introduction to Computing II

Multiplying integers EXERCISE 2B INDIVIDUAL PATHWAYS. -6 ì 4 = -6 ì 0 = 4 ì 0 = -6 ì 3 = -5 ì -3 = 4 ì 3 = 4 ì 2 = 4 ì 1 = -5 ì -2 = -6 ì 2 = -6 ì 1 =

( ) D x ( s) if r s (3) ( ) (6) ( r) = d dr D x

MAGIC058 & MATH64062: Partial Differential Equations 1

Andersen s Algorithm. CS 701 Final Exam (Reminder) Friday, December 12, 4:00 6:00 P.M., 1289 Computer Science.

Spring 2017 Exam 1 MARK BOX HAND IN PART PIN: 17

Uniform Circular Motion

MTH 146 Class 7 Notes

FI 2201 Electromagnetism

The Area of a Triangle

df dt f () b f () a dt

A Primer on Portfolio Theory

Lecture 7 notes Nodal Analysis

L35-Wed-23-Nov-2016-Sec-5-5-Properties-of-Logs-HW36-Moodle-Q29

Rigid Body Dynamics. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2018

Lecture 14. Protocols. Key Distribution Center (KDC) or Trusted Third Party (TTP) KDC generates R1

Reversing the Chain Rule. As we have seen from the Second Fundamental Theorem ( 4.3), the easiest way to evaluate an integral b

IMPOSSIBLE NAVIGATION

Math 426: Probability Final Exam Practice

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

Linear Inequalities. Work Sheet 1

Lecture 3: Equivalence Relations

f(x) dx with An integral having either an infinite limit of integration or an unbounded integrand is called improper. Here are two examples dx x x 2

E-Companion: Mathematical Proofs

Physics 11b Lecture #2. Electric Field Electric Flux Gauss s Law

set is not closed under matrix [ multiplication, ] and does not form a group.

Duke Math Meet

Chapter 5 Bending Moments and Shear Force Diagrams for Beams

PHYS 2421 Fields and Waves

Physics 505 Fall 2005 Midterm Solutions. This midterm is a two hour open book, open notes exam. Do all three problems.

Linear Systems with Constant Coefficients

St Andrew s Academy Mathematics Department Higher Mathematics VECTORS

Waveguide Guide: A and V. Ross L. Spencer

Technical Appendix for Inventory Management for an Assembly System with Product or Component Returns, DeCroix and Zipkin, Management Science 2005.

Electric Potential. and Equipotentials

THIS PAGE DECLASSIFIED IAW E

Quadratic reciprocity

Transcription:

Chte 5: You Pogm Asks fo Advce. Pge 63 Chte 5: You Pogm Asks fo Advce. Ths chte ntoduces new tye of ves (stng ves) nd how to get text nd numec esonses fom the use. Anothe Tye of Ve The Stng Ve: In Chte 3 you got to see numec ves, whch cn ony stoe whoe o decm numes. Sometmes you w wnt to stoe stng, text suounded y quotton mks ("" o ''), n the comute's memoy. To do ths we use new tye of ve ced the stng ve. A stng ve s denoted y endng do sgn $ on ve nme. You my ssgn nd eteve vues fom stng ve the sme wy you use numec ve. Rememe, the ve nme, cse senstvty, nd eseved wod ues e the sme wth stng nd numec ves. 1 2 3 4 5 6 7 8 9 10 11 # c5_kejm.ks # I ke jm stng ves nme$ = "Jm" fstmessge$ = '"' nme$ '" s my fend.' secondmessge$ = "I ke " nme$ "." nt fstmessge$ sy fstmessge$ nt secondmessge$ sy secondmessge$ Pogm 26: I Lke Jm "Jm" s my fend. 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 64 I ke Jm. Sme Outut 26: I Lke Jm Stng ve A stng ve ows you to ssgn nme to ock of stoge n the comute's shot-tem memoy. You my stoe nd eteve text nd chcte vues fom the stng ve n you ogm. A stng ve nme must egn wth ette; my contn ettes nd numes; e cse senstve; nd ends wth do sgn. Aso, you cn not use wods eseved y the BASIC-256 nguge when nmng you ves (see Aendx I). Exmes of vd stng ve nmes ncude: d$, c7$, ook$, X$, nd nyd$. If you ssgn numec vue to stng ve, BASIC-256 w convet the nume to stng of chctes nd ssgn t to the ve. If you ttemt to ssgn stng to numec ve, you w eceve syntx eo. Inut Gettng Text o Numes Fom the Use: So f we hve tod the ogm eveythng t needs to know n the ogmmng code. The next sttement to ntoduce s. The sttement ctues ethe stng o nume tht the use tyes nto the text e nd stoes tht vue n ve. 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 65 Let's tke Pogm 26 nd modfy t so tht t w sk you fo nme nd then sy heo to tht eson. 1 2 3 4 5 6 7 8 9 10 11 # c5_ke.ks # usng to sk fo nme "ente you nme>", nme$ fstmessge$ = nme$ " s my fend." secondmessge$ = "I ke " nme$ "." nt fstmessge$ sy fstmessge$ nt secondmessge$ sy secondmessge$ Pogm 27: I Lke f n the nk ente you nme>vnce Vnce s my fend. I ke Vnce. Sme Outut 27: I Lke f n the nk 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 66 "omt", stngve$ "omt", numecve stngve$ numecve The sttement w eteve stng o nume tht the use tyes nto the text outut e of the sceen. The esut w e stoed n ve tht my e used te n the ogm. A omt messge, f secfed, w dsy on the text outut e nd the cuso w decty foow the omt. If numec esut s desed (numec ve secfed n the sttement) nd the use tyes stng tht cn not e conveted to nume the sttement w set the ve to zeo (0). The "Mth-wz" ogm shows n exme of wth numec ves. 1 2 3 4 5 6 7 8 9 10 11 12 # c5_mthwz.ks # show seve mthemtc oetons "? ", "? ", nt nt nt nt nt nt "" "-" "-" "*" "/" "/" () (-) (-) (*) (/) (/) Pogm 28: Mth-wz? 7? 56 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 67 756=63 7-56=-49 56-7=49 7*56=392 7/56=0.125 56/7=8 Sme Outut 28: Mth-wz Ths chte hs two "Bg Pogms" The fst s fncy ogm tht w sy you nme nd how od you w e n 8 yes nd the second s sy stoy geneto. 1 2 3 4 5 6 7 8 9 10 11 12 # c5_synme.ks "Wht s you nme?", nme$ "How od e you?", ge geetng$ = "It s nce to meet you, " nme$ "." nt geetng$ sy geetng$ geetng$ = "In 8 yes you w e " (ge 8) " yes od. Wow, thts od!" nt geetng$ sy geetng$ Pogm 29: Fncy Sy Nme Wht s you nme?joe 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 68 How od e you?13 It s nce to meet you, Joe. In 8 yes you w e 21 yes od. thts od! Wow, Sme Outut 29: Fncy Sy Nme 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 # c5_systoy.ks nt "A Sy Stoy." noun? ", noun1$ ve? ", ve1$ oom n you house? ", oom1$ ve? ", ve2$ noun? ", noun2$ n djectve? ", dj1$ ve? ", ve3$ noun? ", noun3$ You Nme? ", nme$ sentence$ = "A sy stoy, y " nme$ "." nt sentence$ sy sentence$ sentence$ = "One dy, not so ong go, I sw " noun1$ " " ve1$ " down the sts." nt sentence$ sy sentence$ sentence$ = "It ws gong to my " oom1$ " to " ve2$ " " noun2$ nt sentence$ sy sentence$ sentence$ = "The " noun1$ " ecme " dj1$ " when I " ve3$ " wth " noun3$ "." nt sentence$ 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. 29 30 31 32 33 Pge 69 sy sentence$ sentence$ = "The End." nt sentence$ sy sentence$ Pogm 30: Bg Pogm - Sy Stoy Geneto A Sy Stoy. Ente noun? c Ente ve? wk Ente oom n you house? ktchen Ente ve? sng Ente noun? teevson Ente n djectve? huge Ente ve? wtch Ente noun? comute Ente You Nme? Jm A sy stoy, y Jm. One dy, not so ong go, I sw c wk down the sts. It ws gong to my ktchen to sng teevson The c ecme huge when I wtch wth comute. The End. Sme Outut 30: Bg Pogm - Sy Stoy Geneto 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 70 Execses: e y q q t h y d s j s x w v e o t f f c e f m n y n k d g x x h u t n u z y g t g k e f v w t v x w j o z k g q z v n g s o d defut, dosgn,, omt, stng, ve 5.1. Wte ogm to sk fo thee nmes. Stoe them n stng ves. Once the use entes the thd nme hve the comute ecte the cssc ygound song usng the nmes: [Nme One] nd [Nme Two] sttng n tee, K-I-S-S-I-N-G. Fst comes ove, then comes mge, then comes [Nme Thee] n y cge! 5.2. Wte ogm to sk fo n djectve, noun, nm, nd sound. Once the use entes the st one, ud snge stng ve (usng conctenton) to sy vese of Od McDond. Pnt the esut out wth snge sttement nd sy t wth snge sttement. (Adted fom The Od Mcdond Md L fom htt://www.mdgs.com) 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 71 [Adjectve] McDond hd [Noun], E-I-E-I-O nd on tht [Noun] he hd n nm, E-I-E-I-O wth [Sound] [Sound] hee nd [Sound] [Sound] thee, hee [Sound], thee [Sound], eveywhee [Sound] [Sound], [Adjectve] McDond hd [Noun], E-I-E-I-O. 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)

Chte 5: You Pogm Asks fo Advce. Pge 72 2014 Jmes M. Reneu (CC BY-NC-SA 3.0 US)