# Assignment 02: Parable Of The Polygons Solved

25.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . ` zip` solution files instantly, after Payment

## Description

5/5 - (1 vote)
• This project is based on a “playable post” by Vi Hart and Nicky Case calledÂ Parable of the Polygons, illustrating the effects of bias on population segregation.
• The goal of this project is to get some practice with multiple file projects, pointers, and (above all) beginning to intermediate level classes.

This project may take a lot of time. Please plan accordingly. Also, this project may contain wording you are not yet used to. Please be patient while working out what it means, as feel free to ask me if you need help.

## Requirements

### Week 1

Fill in theÂ `TODO`s (to-do’s) inÂ buffer.cppÂ so that the test functionÂ `test_buffer()`Â inÂ main.cppÂ runs and produces the output

``````--------------------------------------------------------------------------------
|                                                                              |
|                                                                              |
|                                      * *                                     |
|                                                                              |
|                                  *         *                                 |
|                                                                              |
|                                                                              |
|                                                                              |
|                                *             *                               |
|                                                                              |
|                                *             *                               |
|                                                                              |
|                                                                              |
|                                                                              |
|                                  *         *                                 |
|                                                                              |
|                                      * *                                     |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
|                                                                              |
--------------------------------------------------------------------------------
``````

Fill in theÂ `TODO`s (to-do’s) inÂ shape.cppÂ so that the test functionÂ `test_shape()`Â inÂ main.cppÂ runs and produces the output

``````  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.
/ \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   |
/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'
.---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,
|   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \
'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\
,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.
/ \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   |
/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'
.---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,
|   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \
'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\
,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.
/ \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   |
/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'
.---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,
|   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \
'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\
,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.
/ \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   |
/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'
.---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,  .---.  ,
|   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \ |   | / \
'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\'---'/___\
``````

Any functions that are not necessary for these tests to run may be “stubbed out” — that is, filled in just enough for the program to compile and run, without being fully implemented.

### Weeks 2 and 3

Fill in theÂ `TODO`s (to-do’s) inÂ neighborhood.cpp, and any remaining uncompleted code inÂ buffer.cppÂ andÂ shape.cpp, so that the code

```// animate  neighborhood
unsigned int size_x = TERM_SIZE_X/Shape::size_x;
unsigned int size_y = TERM_SIZE_Y/Shape::size_y;
Neighborhood(size_x, size_y).animate(1000);```

inÂ main.cppÂ runs and produces the output shown inÂ demo.mp4.

## Requests

• If you have time, you might want to rewrite your solution from scratch, referencing your first solution (or mine, if you wish) as little as possible (but as much as necessary). I would recommend doing this not only if you have time before the next assignment, but also if you’re able to complete the next assignment early.

## Assumptions

• A terminal window is 80 columns wide by 25 lines high.

## Style

• Place your solution in aÂ `solution--YOURNAME`Â subdirectory (whereÂ `YOURNAME`Â is your GitHub username).
• Include your copyright and license information at the top of every file, followed by a brief description of the file’s contents, e.g.
```/* ----------------------------------------------------------------------------
* Copyright &copy; 2016 Ben Blazak <[email protected]>
* ------------------------------------------------------------------------- */

/**
* A short program to print "Hello World!" to standard output.
*/```
• Use “include guards” in allÂ `.h`Â files. Be sure to give the preprocessor variable a name corresponding to the file name. For example, inÂ `point.h`:
```#ifndef POINT_H
#define POINT_H
// ----------------------------------------------------------------------------

// ... everything besides the copyright information and file description

// ----------------------------------------------------------------------------
#endif  // POINT_H```
• `main()`Â must have its ownÂ `.cpp`Â file. I suggest calling itÂ `main.cpp`.
• Classes must have bothÂ `.h`Â andÂ `.cpp`Â files, with member functions defined in theÂ `.cpp`Â files unless they are truly trivial. If it makes sense, you may put multiple classes into one pair ofÂ `.h`Â andÂ `.cpp`Â files.
• Declare member functions and function arguments asÂ `const`Â when appropriate (in general, whenever possible).
• Document and format your code well and consistently. Be sure to clearly document the source of any code, algorithm, information, etc. that you use or reference while completing your work.
• Wrap lines at 79 or 80 columns whenever possible.
• End your file with a blank line.
• DoÂ notÂ useÂ `using namespace std;`. You may get around typingÂ `std::`Â in front of things or with, e.g.,Â `using std::cout;`.
• assignment-02.zip