11. Assessment 1#

11.1. Programming for Reusability#

11.2. Background#

This assessment requires that you implement a simulation based study of the Game of Pig and some of its variants.

The primary objective is to produce a flexible simulation framework in the sense that future extensions to the scope of the simulation study should be able to be accommodated through re-use of your existing software components in a modular way. Importantly, the framework should be able to incorporate strategies developed and implemented by second parties in the form of code.

Your work developing a simulation of the Iterated Prisoners Dilemma (IPD) during Part 1 of the course should help you with this assessment.

11.3. Assessment#

The main assessment tasks are as follows :

11.3.1. 1. Coding#

11.3.1.1. a. Implementing Pig#

Design and implement a simulation of the Game of Pig using the Python programming language. You should design your code in such a way that such a way that it can simulate variations of Pig. For example:

  • Changing the target score

  • Changing the dice used e.g. number of faces, number of dice

  • Different end games e.g. allowing the second player to play once more if player one reaches the target score.

Your code does not necessarily need to allow for all of these variations, and you can also consider variants of your own making. In order to test your simulation code, you should also develop 2-3 simple heuristic strategies for playing Pig.

Where appropriate, you should use relevant functional design patterns such as those presented in Session 2 of the course notes. You should also document your code appropriately so that it can be re-used.

11.3.1.2. b. Experimentation#

Evaluate the relative effectiveness of the strategies you have developed via simulation. You need only test the strategies for the standard game of Pig. Provide any necessary supporting material to enable second parties to replicate your results.

11.3.2. 2. Report#

You should write up your work in a short report which includes the following:

  • Identification of the sub-components of your design and a description of them in a declarative manner as outlined in Session 2 of the course notes

  • An explanation of your design approach with reference to what data structures and design patterns you used, and any programming features you might have used to achieve your aims. This should include an explanation of how your code could be used to implement any variatations of the game you have considered.

  • A brief explanation of the strategies you have implemented

  • A presentation your numerical results

11.4. Assessment Criteria#

Your submission will be assessed according to the following criteria:

  • Quality of source code: readability of your code (documentation, commenting and style conventions), appropriate use design patterns and data structures, appropriate use of language features and idioms in implementation

  • Solution: the correctness of your solutions, and the robustness of your code

  • Understanding of design principles: your explanations and appraisals demonstrate an understanding of design principles like design patterns and appropriate data structures

  • Quality of written communication: the clarity of your explanation and discussion

11.5. Submitting your work#

Your submission should include:

  • A report

  • Python code

  • A short README file which provide details of how to use your code. In partcular, this should include what version of Python you are using, and any additional packages you are using. You may write your report in a Jupyter notebook which includes code demonstrating your implementation and numerical tests. However, any reusable components (functions, classes etc.) should be put into Python scripts.

You should send all of your files as a single file, e.g. a zip file or a compressed tar ball, by e-mail to Kim Wilson mailto:k.wilson7@lancaster.ac.uk by 12pm Monday 23rd February.

Any technical queries relating to this assessment can be directed by e-mail to Jamie Fairbrother mailto:j.fairbrother@lancaster.ac.uk or
Daniel Grose mailto:dan.grose@lancaster.ac.uk.

Any administrative queries realting to the submission and assessment process should, in the first instance, be directed by e-mail to Jamie Fairbrother mailto:j.fairbrother@lancaster.ac.uk