SlideServe
Menu
Préférences
© SlideServe · v2026

Computer Program Instructions for Sequencing and Designing Creative Pen Drawings

dasan avatar
12 diapositives · 222 Views · Jul 31, 2014

Learn about computer program instructions, loops, branching, and pen commands to create intricate designs with step-by-step guidance. Understand the complexity and functionality of programming through engaging examples.

Computer Program Instructions for Sequencing and Designing Creative Pen Drawings - slide 1
01 / 12Computer Program Instructions for Sequencing and Designing Creative Pen Drawings
1 / 17

Télécharger la présentation

Computer Program Instructions for Sequencing and Designing Creative Pen Drawings
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Computer Program A sequence of step-by-step instructions for the computer to follow

  2. Computer Instructions 1. OPERATION: Evaluate expression, set output, read input, ... 2. JUMP: Jump immediately, and out of sequence to another instruction 3. BRANCH: Evaluate a condition and jump if condition true 4. LOOP: Repeat specified section a number of times

  3. A Program 1. Do this 2. Do that 3. Jump to instruction 6 4. Do the other thing 5. All done, sleep 6. If switch closed, do that thing you do 7. Jump to instruction 4

  4. Pen Computer PEN_UP Lift pen off paper PEN_DOWN Lower pen onto paper MOVX dMove pen a distance d in x direction MOVY dMove pen a distance d in y direction PEN_UP MOVX 8 MOVY 8 PEN_DOWN MOVX 4 MOVY 4 MOVX -4 MOVY -4 PENUP

  5. PEN_UP MOVX 8 MOVY 8 PEN_DOWN MOVX 4 MOVY 4 MOVX -4 MOVY -4 PENUP

  6. Some Complexity: For Loops Initialize counter (once)Check condition. If true, do instructions then increment counter Effect: Repeats instructions for desired number of times for (i=0;i<n;i++) {instructions} Example What is j at the end? Ans: j = 3 Ans: j = 6 j=0 for (i=1;i<4;i++) { j=j+1 } j=0 for (i=1;i<4;i++) { j=j+i }

  7. Program 1 pen_down movx 20 movy 16 movx -20 movy -16 pen_up for (i=1;i<4;i++) { movx 4*i movy 4*i pen_down movx 4 movy 4 movx -4 movy -4 pen_up movx -4*i movy -4*i } (go to top of next column)

  8. More Complexity: If and Functions if (expr) { Evaluate. If true, do instructionsinstructions} myfunction() Jump to myfunction(). When done, return to next instruction.

  9. Program 2 main() { pen_up movx 10 movy 8 pen_down for (i=0;i<5;i++) { movy 1 } movepen() pen_up movx -2 movy -2 pen_down for (i=0;i<4;i++) { movx 1 } pen_up } //end of main, stop here //movepen function movepen() { pen_up movx 4 pen_down movy 4 pen_up movx -4 movy -4 }