



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
During the course work of Thinking Like Computers, we study the key concept of artificial intelligence. The main points in these lecture slides are given as:Dynamic Images, Dynamic Image Example, Javascript, Conditional Execution, If Statements, Boolean Tests, Boolean Expression, Accessing Text Fields, Cascading If-Else Statements, Cleaner Notation
Typology: Slides
1 / 6
This page cannot be seen from the preview
Don't miss anything!
function is called to change the image
note the use of single quotes around the file names to avoid conflicts with the onClick double quotes
the browser carried out statements in the same set order
e.g., a student's course grade depends upon his/her average e.g., an ESP test requires recognizing when a subject guessed right e.g., the outcome of a game depends upon die rolls or player moves
NOTE: == is for comparisons = is for assignments
example: nested if statements vs. a more readable else-if
if (roll == 1) { document.images.die.src = “http://www.pics.com/Images/die1.gif"; } else if (roll == 2) { document.images.die.src = "http://www.pics.com/Images/die2.gif"; } else if (roll == 3) { document.images.die.src = "http://www.pics.com/Images/die3.gif"; } else if (roll == 4) { document.images.die.src = "http://www.pics.com/Images/die4.gif"; } else if (roll == 5) { document.images.die.src = "http://www.pics.com/Images/die5.gif"; } else { document.images.die.src = "http://www.pics.com/Images/die6.gif"; }
document.images.die.src = “http://www.pics.com/Images/die" + roll + ".gif";