CSE1301 Computer Programming: Lecture 29 Group Project: “Quabble”

Slides:



Advertisements
Similar presentations
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Advertisements

Traditional Approach to Design
Chapter 10 The Traditional Approach to Design
Reference :Understanding Computers
Chapter 2 - Problem Solving
Chapter 9: The Traditional Approach to Design Chapter 10 Systems Analysis and Design in a Changing World, 3 rd Edition.
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
1 CSE1301 Computer Programming: Lecture 23 Algorithm Design (Part 1)
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
1 CSE1301 Computer Programming Lecture 25: Software Engineering.
1 CSE1301 Computer Programming Lecture 26: Case Study.
CSE1301 Computer Programming: Lecture 27 Game Programming: Bingo.
CSE1301 Computer Programming: Lecture 21 Software Engineering.
1 Midterm Review COMP 102. Tips l Eat a light meal before the exam l NO electronic devices (including calculators, dictionaries, phones, pagers, etc.)
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 1 Program Design
1 CSE1301 Computer Programming: Lecture 25 Software Engineering 2.
CSE1301 Computer Programming: Revision. Topics Type of questions What do you need to know? About the exam Exam technique Sample questions.
BPC.1 Basic Programming Concepts
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
1 CSE1301 Computer Programming: Lecture 25 Group Project: "Hunt the Wumpus”
CSE 1340 Introduction to Computing Concepts Class 2.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
TESTING.
Simple Program Design Third Edition A Step-by-Step Approach
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Modular Programming Chapter Value and Reference Parameters computeSumAve (x, y, sum, mean) ACTUALFORMAL xnum1(input) ynum2(input) sumsum(output)
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Chapter 9 Moving to Design
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
Introduction to Computer Programming Using C Session 23 - Review.
SE: CHAPTER 7 Writing The Program
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Developing an Algorithm
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
CPS120: Introduction to Computer Science Functions.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
The Software Development Process
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
1 CSE1301 Computer Programming Lecture 24: Software Engineering.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 1 Monday 29 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Intermediate 2 Computing Unit 2 - Software Development.
The Hashemite University Computer Engineering Department
Observing the Current System Benefits Can see how the system actually works in practice Can ask people to explain what they are doing – to gain a clear.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
A First Book of ANSI C Fourth Edition
Progression in KS3/4 Algorithms MONDAY 30 TH NOVEMBER SUE SENTANCE.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
 Problem Analysis  Coding  Debugging  Testing.
Advanced Higher Computing Science The Project. Introduction Worth 60% of the total marks for the course Must include: An appropriate interface using input.
Computer Programming 12 Lesson 4 - Computer Programming Structure By Dan Lunney.
Systems Analysis and Design in a Changing World, Fourth Edition
Chapter 1: Introduction to Computers and Programming
Software Testing.
Systems Analysis and Design
Lecture 2 Introduction to Programming
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Chapter 1: Introduction to Computers and Programming
Unit# 9: Computer Program Development
The Programming Process
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

CSE1301 Computer Programming: Lecture 29 Group Project: “Quabble”

Topics Motivation Tasks The Game: Quabble Design Document

Motivation Experience developing software with others Go through phases of software development cycle Produce a design document, write code from it Write code using functions, arrays and structs Construct test sets: – for functions –for complete program. Combine functions written by different people

Tasks Analyse a problem specification Decompose a large program into smaller pieces –combine top-down and bottom-up design Design data structures Write algorithms for functions Turn algorithms into code Test functions and complete program

“Quabble” W4W4 The Bag of Tiles, each tile: The Game Board: A1A1 I1I1 W4W4 D2D2 A1A1 M3M3 E1E1 N1N1 Quabs: The Main Aim: –form words using tiles on the board –word must include all quabs –score: sum of the points on the tiles

Example

The Blank Tile Can be used as a substitute to any letter Does not earn points Example: Y4Y4 D2D2 T1T1 Z 10  M3M3 I1I1 C3C3 Quabs: Valid words: DAY (6), DIRTY (8), DIZZY (17)

Bonus Points Double Points: –If there are no blank tiles on the board, and –player forms a word using all the tiles –Then, player earns twice the points for that word. Extra Points: –If the player is able to guess all the valid words found by the program –Then, player earns twice the number of words found

Dictionary File Lists all (almost) known English words Plain text (not Word document!) One word per line Not necessarily alphabetically sorted Some words may be capitalised Sample dictionary: words.txt –used by a spell checker –contains proper nouns –US English spelling

Configuration File Sample configuration file: quabble.cfg 8 2 words.txt * 2 0 A 9 1 B 2 3 C 2 3 D 4 2 E

The Program: Initialization Reads configuration file to determine: –number of tiles on the board –number of quabs –how many tiles per letter (including blank) –how many points per letter Set up the bag of tiles

The Program: Board Setup Pick the tiles from the bag at random Find all valid words –while there is no solution, put the tiles aside and pick a new set of tiles from the bag –Q: What if no valid words can be formed, and the bag ran out of tiles? –A: Put all tiles back into the bag and re-mix. Compute maximum total points the player can earn

The Program: Interaction Must be case insensitive –Eg: “Maiden”, “maiden”, “maIdEN”, “MAIDEN” Must show: –player’s current score –number of valid words the player has found so far –number of words yet to be found –total points left for the player to earn Correct guess: show points earned Wrong guess: preferably, say why

The Program: End of Game Game finishes when: –player found all the valid words (and earns extra points) –player gives up If player gave up: –show all words missed by the player –show total points the player could have earned Show: –player’s cumulative score on all boards played –cumulative maximum total points

The Program: New Game At the end of each game, the player can: –end program, or –play a new board (game): If player wants to play a new board: –Tiles on the board are set aside, and a new set is taken from the bag –If there are not enough tiles left in the bag, put all tiles back into the bag and re-mix. –(Recall: Board must have at least one solution)

How Do We Start? How do we represent the data? What are the data sources, sinks and storage? What operations / actions / manipulations can we do with each of those data? How can we use these operations as building blocks to accomplish the task? –top-down –bottom-up Design Document

Sections: –data –modules –algorithms –test data –Program I/O –Group Organization Marked as a group effort

Data Structures How do we represent the data? –a tile –a board –a bag of tiles –a word –the program’s answer key –the player’s answer sheet –a game –transaction data Actual C code

Data and Modules Bottom-Up approach: –From simple operations on simple data to complex operations on complex data –Example: operations on a tile: initialize, print operations on a board: initialize, print printing a board: print a tile at a time

Modules Top-Down Approach: –From biggest to smallest task –Example: Main algorithm initialization board setup interaction validation end game

Modules Top-Down Approach: –From biggest to smallest task –Example: Main algorithm initialization –read configuration file –initialize bag of tiles –initialize score board setup interaction validation end game

Modules Structure chart –control coupling –data coupling avoid implicit data coupling (global variables) size of data coupling corresponds roughly to level Purpose and functionality of each module Actual C function name and prototype (parameters and return type)

Algorithms Describe in pseudo-code or flow-chart Review structure chart: –Do the parameters provide all the information we need? –Can the encapsulation of the parameters and return values into a single transaction data structure help produce a cleaner algorithm for the module? –Are the modules coherent?

Test Data How do we test that modules, and the whole program, are correct? Test data: Valid, Invalid, Boundary Test all possible execution paths Need for small test programs which pass test data into a function, and show the results. Possible limitations with respect to invalid test data.

Program I/O Input and Output: Data-flow diagram Not just user interface: I/O to file, printer, etc as well Simple text-based user interface: okay

Group Organization Equal distribution of labor Demonstrator’s approval Basis for marking Part 2.

Individual Modules Code, compile, test, document “The C Style Guide” Need for test programs (simple main() ) Marking: Individual –proportional to how much of your assigned tasks you were able to complete –no extra marks for doing other people’s tasks

System Integration Usual cause of problems: –global variables (implicit coupling) –poor design: overlapping modules –module’s functionality not clearly defined –conflicting data structure or function name –data coupling (parameters and return values) do not match –embedded numbers in the code, rather than using const or #define. –poor documentation (functions and in-line)

Advanced Component Specification 1 –Dictionary Update –Multiple Players Specification 2 –Unique Boards Specification 3 –Timer

Miscellaneous Sample Bingo Program –Randomization (also: Dietel & Dietel 5.9) –Avoiding duplicates –Validating numerical input –Use of #include and #define Tip: No need to load the whole dictionary file into memory Group coordination: Contact details! Questions? Have fun!