Animated Program Design Intermediate Program Design Using Video Game Development

This textbook presents a systematic methodology for program development by using design recipes, i.e. a series of steps, each with a specific outcome, that takes a problem solver from a problem statement to a working and tested programmed solution. It introduces the reader to generative recursion, h...

Full description

Saved in:
Bibliographic Details
Main Author Morazan, Marco T
Format eBook
LanguageEnglish
Published Cham Springer International Publishing AG 2022
Springer International Publishing
Edition1
SeriesTexts in Computer Science
Subjects
Online AccessGet full text

Cover

Loading…
Table of Contents:
  • 38 What Have We Learned in This Chapter? -- 8 N-Puzzle Version 3 -- 39 The Design of make-move -- 39.1 Problem Analysis -- 39.2 Sample Expressions and Differences -- 39.3 Signature, Purpose, and Function Header -- 39.4 Tests -- 39.5 Function Body -- 40 The Design of find-solution-bfs -- 40.1 Problem Analysis -- 40.2 Sample Expressions and Differences -- 40.3 Signature, Statements, and Function Header -- 40.4 Tests -- 40.5 Function Body -- 40.6 Termination Argument -- 41 Performance -- 42 What Have We Learned in This Chapter? -- Part III Accumulative Recursion -- 9 Accumulators -- 43 Running Totals -- 43.1 Problem Analysis for lon-running-totals -- 43.2 Sample Expressions and Differences for lon-running-totals -- 43.3 Signature, Function Definition, and Tests for lon-running-totals -- 43.4 Problem Analysis for lon-running-totals- helper -- 43.5 Sample Expressions and Differences for lon-running-totals-helper -- 43.6 Signature, Function Definition, and Tests for lon-running-totals-helper -- 43.7 The lon-sum Function -- 44 Running Totals Using an Accumulator -- 44.1 Problem Analysis -- 44.2 Sample Expressions and Differences for lon-running-totals-v2 -- 44.3 Function Definition for lon-running-totals-v2 -- 44.4 Tests for lon-running-totals-v2 -- 44.5 Problem Analysis for lon-running-totals-helper-v2 -- 44.6 Sample Expressions and Differences for lon-running-totals-helper-v2 -- 44.7 Signature, Statements, and Function Header for lon-running-totals-helper-v2 -- 44.8 Tests for lon-running-totals-helper-v2 -- 44.9 Function Body for lon-running-totals- helper-v2 -- 45 Performance and Complexity Analysis -- 46 Finding a Path in a Directed Graph -- 46.1 Data Analysis -- 46.2 Design and Implementation of find-path -- 46.2.1 Problem Analysis -- 46.2.2 Sample Expressions and Differences -- 46.2.3 Signature, Purpose, and Function Definition -- 46.2.4 Tests
  • Intro -- Preface -- 1 The Parts of the Book -- 2 Acknowledgments -- Contents -- Part I Basic Problem Solving and Program Design -- 1 The Science of Problem Solving -- 3 The Design Recipe -- 4 Computing the Area of a Triangle -- 4.1 Exercises -- 5 Doubling a List of Numbers -- 5.1 Step 1: Data Analysis and Design Idea -- 5.2 Step 2: Sample Expressions -- 5.3 Step 3: Differences Among Sample Expressions -- 5.4 Steps 4-5: Signature, Purpose Statement, and Function Header -- 5.5 Step 6: Tests -- 5.6 Step 7: Function Body -- 5.7 Step 8: Run Tests -- 5.8 Exercises -- 6 Code Refactoring -- 6.1 Exercises -- 7 Abstract Running Time -- 7.1 Exercises -- 8 What Have We Learned in This Chapter? -- 2 The N-Puzzle Problem -- 9 The world and the run Function -- 10 Useful Constants -- 11 The draw-world Handler -- 12 The game-over? Handler -- 13 The process-key Handler -- 13.1 The Design of vk? -- 13.2 The Design of process-vk -- 13.2.1 Computing the Position of the Empty Space -- 13.2.2 The Design of get-target-bpos -- 13.2.3 The Design of swap-empty -- 13.2.4 The Design of make-move -- 14 What Have We Learned in This Chapter? -- 3 Randomness -- 15 ISL+'s random Function -- 16 N-Puzzle Version 1 -- 17 Generating Random Passwords -- 18 Distributed Fortune Teller Game -- 18.1 Design Recipe for Distributed Computing -- 18.2 The Components -- 18.3 Data Definitions -- 18.3.1 Player Data Definitions -- 18.3.2 Server Data Definitions -- 18.4 Communication Protocol -- 18.5 Marshaling and Unmarshaling Functions -- 18.6 The Player Component -- 18.6.1 The draw-world Handler -- 18.6.2 The process-key Handler -- 18.6.3 The process-message Handler -- 18.6.4 The finished? Handler -- 18.7 The Server Component -- 18.7.1 The add-new-iworld Handler -- 18.7.2 The rm-iworld Handler -- 18.7.3 The process-message Handler -- 19 What Have We Learned in This Chapter?
  • 53 List-Folding Operations from the Left
  • Part II Generative Recursion -- 4 Introduction to Generative Recursion -- 20 Generating a Nested Square Image -- 21 The Design Recipe for Generative Recursion -- 22 All Primes n -- 23 What Have We Learned in This Chapter? -- 5 Sorting -- 24 Insertion Sorting -- 25 Quick Sorting -- 25.1 Problem Analysis -- 25.2 Sample Expressions and Differences -- 25.3 Signature, Statements, and Function Header -- 25.4 Tests -- 25.5 Function Body -- 25.6 Termination Argument -- 25.7 Performance -- 25.8 Complexity Analysis -- 26 Merge Sorting -- 26.1 Problem Analysis -- 26.2 The merge-sorting Function -- 26.2.1 Problem Analysis -- 26.2.2 Sample Expressions and Differences -- 26.2.3 Signature, Purpose, and Function Header -- 26.2.4 Tests -- 26.2.5 Function Body -- 26.3 The merge-sort-helper Function -- 26.3.1 Problem Analysis -- 26.3.2 Sample Expressions and Differences -- 26.3.3 Signature, Statements, and Function Header -- 26.3.4 Tests -- 26.3.5 Function Body -- 26.3.6 Termination Argument -- 26.4 The merge-neighs Function -- 26.4.1 Problem Analysis -- 26.4.2 Sample Expressions and Differences -- 26.4.3 Signature, Statements, and Function Header -- 26.4.4 Tests -- 26.4.5 Function Body -- 26.4.6 Termination Argument -- 26.5 The merge Function -- 26.5.1 Problem Analysis -- 26.5.2 Sample Expressions and Differences -- 26.5.3 Signature, Statements, and Function Header -- 26.5.4 Tests -- 26.5.5 Function Body -- 26.6 Performance -- 26.7 Complexity Analysis -- 27 What Have We Learned in This Chapter? -- 6 Searching -- 28 Linear Searching -- 28.1 Problem Analysis -- 28.2 Sample Expressions and Differences -- 28.3 Signature, Purpose, and Function Header -- 28.4 Tests -- 28.5 Function Body -- 28.6 Performance and Complexity -- 29 Binary Search -- 29.1 The binary-search Function -- 29.1.1 Problem Analysis -- 29.1.2 Sample Expressions and Differences
  • 29.1.3 Signature, Statements, and Function Header -- 29.1.4 Tests -- 29.1.5 Function Body -- 29.2 The bin-search Function -- 29.2.1 Problem Analysis -- 29.2.2 Sample Expressions and Differences -- 29.2.3 Signature, Statements, and Function Header -- 29.2.4 Tests -- 29.2.5 Function Body -- 29.3 Termination Argument -- 29.4 Performance and Complexity -- 30 Trees -- 31 Depth-First Search -- 31.1 Problem Analysis -- 31.2 Sample Expressions and Differences -- 31.3 Signature, Purpose, and Function Header -- 31.4 Tests -- 31.5 The Function Body -- 31.6 The node-dfs-contains? Function -- 31.6.1 Problem Analysis -- 31.6.2 Sample Expressions -- 31.7 Signature, Purpose, and Function Definition -- 31.7.1 Tests -- 31.8 Performance and Complexity -- 32 Breadth-First Search -- 32.1 Problem Analysis for ton-bfs-contains? -- 32.1.1 Queues -- 32.1.2 The Implementation of qempty? and qfirst -- 32.1.3 The Implementation of enqueue and dequeue -- 32.2 Sample Expressions and Differences for ton-bfs-contains? -- 32.3 Tests for ton-bfs-contains? -- 32.4 Function Definition for ton-bfs-contains? -- 32.5 Problem Analysis for bfs-helper -- 32.6 Sample Expressions and Differences for bfs-helper -- 32.7 Tests for bfs-helper -- 32.8 Signature, Statements, and Function Definition for bfs-helper -- 32.9 Performance and Complexity -- 33 What Have We Learned in This Chapter? -- 7 N-Puzzle Version 2 -- 34 Design and Implementation of make-move -- 34.1 Problem Analysis -- 34.2 Sample Expressions and Differences -- 34.3 Signature, Purpose, and Function Header -- 34.4 Tests -- 34.5 Function Body -- 35 Design and Implementation of find-solution -- 35.1 Problem Analysis -- 35.2 Sample Expressions and Differences -- 35.3 Signature, Statements, and Function Header -- 35.4 Tests -- 35.5 Function Body -- 35.6 Termination Argument -- 36 New Tests for process-key -- 37 A Bug: Infinite Recursion
  • 46.3 Design and Implementation of find-path-acc -- 46.3.1 Problem Analysis -- 46.3.2 Sample Expressions and Differences -- 46.3.3 Signature, Purpose, Invariant, and Function Header -- 46.3.4 Tests -- 46.3.5 Function Body -- 46.4 Design and Implementation of find-path-from-neighbors -- 46.4.1 Problem Analysis -- 46.4.2 Sample Expressions and Differences -- 46.4.3 Signature, Purpose, Invariant, and Function Header -- 46.4.4 Tests -- 46.4.5 Function Body -- 46.5 Termination Argument -- 47 Revisiting Insertion Sorting -- 47.1 The Redesign of insert -- 47.1.1 Problem Analysis -- 47.1.2 Sample Expressions and Differences -- 47.1.3 Signature, Statements, and Function Header -- 47.1.4 Tests -- 47.1.5 Function Body -- 47.2 The Redesign of insertion-sorting -- 47.2.1 Problem Analysis -- 47.2.2 Sample Expressions and Differences -- 47.2.3 Signature, Purpose, Invariant, and Function Header -- 47.2.4 Tests -- 47.2.5 Function Body -- 47.3 Performance and Complexity Analysis -- 48 What Have We Learned in This Chapter? -- 10 N-Puzzle Versions 4 and 5 -- 49 N-Puzzle Version 4 -- 49.1 The Design and Implementation of find-solution -- 49.1.1 Problem Analysis -- 49.1.2 Sample Expressions and Differences -- 49.1.3 Signature, Statements, and Function Header -- 49.1.4 Tests -- 49.1.5 Function Body -- 49.2 The find-solution-from-any-succ Design and Implementation -- 49.2.1 Problem Analysis -- 49.2.2 Sample Expressions and Differences -- 49.2.3 Signature, Statements, and Function Header -- 49.2.4 Tests -- 49.2.5 Function Body -- 49.3 Termination Argument -- 50 N-Puzzle Version 5 -- 50.1 Problem Analysis -- 50.2 Sample Expressions and Differences -- 50.3 Signature, Statements, and Function Header -- 50.4 Tests -- 50.5 Function Body -- 50.6 Termination Argument -- 51 Complexity and Performance -- 52 What Have We Learned in This Chapter? -- 11 Iteration