Programming Assignment #6

Slides:



Advertisements
Similar presentations
Introduction to Parallel Processing Final Project SHARKS & FISH Presented by: Idan Hammer Elad Wallach Elad Wallach.
Advertisements

More on Dynamic Memory Allocation Seokhee Jeon Department of Computer Engineering Kyung Hee University 1 Illustrations, examples, and text in the lecture.
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Strings and Dynamic Memory Allocation CS-2301, B-Term Programming Assignment #6 Strings and Dynamic Memory Allocation CS-2301, System Programming.
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
Programming Assignment #4 CS-2301, B-Term Programming Project #4 Arrays and Pointers Due, November 24, 11:59 PM (Assignment adapted from C: How to.
Programming Assignment #4 Binary Trees
More on Operator Overloading CS-2303, C-Term More on Operator Overloading CS-2303 System Programming Concepts (Slides include materials from The.
A Deeper Look at Classes CS-2303, C-Term A Deeper Look at Classes CS-2303 System Programming Concepts (Slides include materials from The C Programming.
Symbolic Constants in CCS-2303, C-Term Digression – Symbolic Constants in C CS-2303, System Programming Concepts (Slides include materials from The.
 2006 Pearson Education, Inc. All rights reserved. Templates (again)CS-2303, C-Term Templates (again) CS-2303 System Programming Concepts (Slides.
CS305j Introduction to Computing Two Dimensional Arrays 1 Topic 22 Two Dimensional Arrays "Computer Science is a science of abstraction -creating the right.
Project 1CS-4513, D-Term Programming Project #1 Concurrent Game of Life Due Friday, March 20.
PolymorphismCS-2303, C-Term Polymorphism Hugh C. Lauer Adjunct Professor (Slides include materials from The C Programming Language, 2 nd edition,
Operator OverloadingCS-2303, C-Term Operator Overloading CS-2303 System Programming Concepts (Slides include materials from The C Programming Language,
Topic 26 Two Dimensional Arrays "Computer Science is a science of abstraction -creating the right model for a problem and devising the appropriate mechanizable.
Dynamic Storage Allocation
CS101 Computer Programming I
Programming Assignment #4 Binary Trees in C++
More about Numerical Computation
Makefiles and Notes on Programming Assignment PA2
Topic 26 Two Dimensional Arrays
“Human Sorting” It’s a “Problem Solving” game:
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Inheritance Virtual Functions, Dynamic Binding, and Polymorphism
Strings and Streams Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
“Under the Hood” of Polymorphism
Classes, Constructors, etc., in C++
Containers and the Standard Template Library (STL)
Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Miscellaneous C++ Topics
Dynamic Memory Allocation (and Multi-Dimensional Arrays)
Structures, Unions, and Typedefs
Arrays and Pointers in C & C++
Derived Classes in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Linked Lists in C and C++
Binary Trees (and Big “O” notation)
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Bit Fields & Bitwise Operations
CS-2303 System Programming Concepts
Programming Assignment #1 12-Month Calendar—
Programming Project #1 Command Shell
Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
History and Background
Symbolic Constants in C
Recursion and Implementation of Functions
Accessing Files in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Scope Rules and Storage Types
Programming Assignment #5
Differences between Java and C
STL: Traversing a Vector
Strings in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Elements of a Python Program
Variables, Lists, and Objects
Debuggers and Debugging
Programming Project #1 Fork and Command Shell
Objects (again) Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
More elements of Python programs
Your first C and C++ programs
Iterators Professor Hugh C. Lauer CS-2303, System Programming Concepts
Note on Program Design Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
Operator Overloading Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Functions in C and C++ CS-2303 System Programming Concepts Hugh C. Lauer (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Digression on Loop Invariants
Inheritance Virtual Functions, Dynamic Binding, and Polymorphism
Lab Project #4: PerfLab— Code Optimizations and Performance
A Deeper Look at Classes
CS-2303 Introduction (continued)
Numpy, pylab, matplotlib (follow-up)
“Human Sorting” It’s a “Problem Solving” game:
Presentation transcript:

Programming Assignment #6 Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan and Ritchie, Absolute C++, by Walter Savitch, The C++ Programming Language, Special Edition, by Bjarne Stroustrup, and from C: How to Program, 5th and 6th editions, by Deitel and Deitel) CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Design and implement a simple predator-prey simulation At least one abstract base class and at least two derived classes Virtual functions in the base calls Concrete implementations in each of the derived classes This is Project #3 of Chapter 15 of Absolute C++ CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Simulation N-by-N grid of cells Each cell may be occupied by at most one organism Two types of organisms Ants Doodlebugs Simulate a sequence of steps Each step represents an action by each organism CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Simulation steps Ants Doodlebugs Move:– Try to move in random direction Up, down, left, righ If occupied, stay put No moving off edge of grid Breed:– If survive >= 3 steps Give birth to new ant in adjacent cell No empty cell, no birth Move:– Move to adjacent cell with ant Eat ant If no ant, move to empty cell If no empty cell, stay put Breed:– If survive >= 8 steps Give birth in adjacent cell No empty cell, no birth Starvation:– If no eat in 3 steps, die CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Implementation Any design for implementing grid E.g., array of C++ vectors C-style 2-D array (as in Game Of Life) Anything else appropriate Size determined at run time Grid elements are organism * Null pointer  empty cell Invoke move() method of non-empty cell move() method may invoke other methods E.g., eat, breed, etc. CS-2303, A-Term 2012 Programming Assignment #6

Implementation (continued) Command Line arguments ./PA5 gridSize #doodlebugs #ants seed for random # gen.Need a way to stop simulation Need a way to have simulation pause and print in real time CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Teams Optional two-person teams May not be same teams as previous projects Due Sunday, October 7 @ 11:59 PM CS-2303, A-Term 2012 Programming Assignment #6

Programming Assignment #6 Questions? CS-2303, A-Term 2012 Programming Assignment #6