lesson 03: computer programming. the algorithm a list of well-defined instructions for completing a...
TRANSCRIPT
![Page 1: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/1.jpg)
D I FLesson 03:Computer
Programming
![Page 2: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/2.jpg)
The Algorithm
A List of Well-Defined Instructions for
Completing a Task.
![Page 3: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/3.jpg)
Algorithm to Bake a Cake
![Page 4: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/4.jpg)
How Detailed Does an
Algorithm Need to Be?
![Page 5: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/5.jpg)
Troubleshooting Algorithm
![Page 6: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/6.jpg)
Boolean Logic
![Page 7: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/7.jpg)
Logic Gates
Logic Gates Venn Diagrams
![Page 8: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/8.jpg)
Combining Logic Gates
![Page 9: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/9.jpg)
Nerd Venn Diagram
![Page 10: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/10.jpg)
Historyof
ComputerLanguages
![Page 11: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/11.jpg)
First Computer Program
Ada Lovelace
![Page 12: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/12.jpg)
First Actual Computer Bug
Grace Murray Hopper, 1945
![Page 13: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/13.jpg)
Punch Cards
![Page 14: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/14.jpg)
Machine Languages (1GL)
Binary Instructions for a Specific CPU
![Page 15: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/15.jpg)
Assembly Languages (2GL)
Mnemonic Instructions (CPU Specific)
![Page 16: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/16.jpg)
Fortran, ALGOL, COBOL (3GL)
COBOL Coding FormInstruction Explosion, Machine Independence
![Page 17: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/17.jpg)
Modern Programming Languages
• Visual Basic, SQL (4GL): Higher Instruction Explosion, database support
• Lisp, Prolog (5GL): Expert Systems, Artificial Intelligence applications
• C++, Java (Object-Oriented (OOP)): code reuse
• VBScript, JavaScript, PHP (Scripting): web development
![Page 18: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/18.jpg)
Family Tree of Programming Languages
![Page 19: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/19.jpg)
Programming Concepts
![Page 20: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/20.jpg)
Variables Examples
VARCHAR / CHAR “John Smith”, “TEST”, “ABC123”
INTEGER / DECIMAL / FLOAT
1234, 1000101, 3.14159, -400, 10.01, -.001
BOOLEAN True/False, 0/1
DATE / TIME 03/14/2010 01:59:26
ARRAY colors{red, orange, yellow, green, blue, indigo, violet}
![Page 21: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/21.jpg)
Conditional Logic
IF / THEN
SWITCH / CASE
FOR LOOP
WHILE LOOP
![Page 22: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/22.jpg)
Sample Program: Bubble Sortvar cards=new Array();cards[0] = 4;cards[1] = 12; //Queen cards[2] = 8;cards[3] = 5;cards[4] = 11; //Jackcards[5] = 10;cards[6] = 14; //Acecards[7] = 9;cards[8] = 13; //Kingcards[9] = 6;cards[10]= 3;cards[11]= 7;cards[12]= 2;
function swapCards(cards, firstIndex, secondIndex){ var temp = cards[firstIndex]; cards[firstIndex] = cards[secondIndex]; cards[secondIndex] = temp;}
function bubbleSort(cards){ var len = cards.length; var cardsSorted = false;
while (cardsSorted == false) { cardsSorted = true;
for (i=0; i < len; i++) { if (cards[i] > cards[i+1]) { swapCards(cards, i, i+1); cardsSorted = false; } } } return cards;}
FUNCTIONINTEGERBOOLEANLOOPIF/THENARRAY
![Page 23: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/23.jpg)
Cut and Paste Programming
• TIC TAC TOE–Number Version–Hard Conditional Logic Version–Intelligent Version
• Game of Life• Super Mario World in JavaScript
![Page 24: Lesson 03: Computer Programming. The Algorithm A List of Well-Defined Instructions for Completing a Task](https://reader036.vdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b47266/html5/thumbnails/24.jpg)
JavaScript Game Resources
• http://javascript.internet.com/games/
• http://www.jsmadeeasy.com/javascripts/Games/list_test.asp
• http://www.javascriptkit.com/script/cutindex22.shtml
• http://www.javascriptgaming.com/