Haskell代写|Assignment 2: Cellular Automata



Required Knowledge

Students who have worked up to the Week 6 lab should have the programming knowledge required for this assignment; in particular you will need to work with recursion and parametric polymorphism. The Week 7 lab will help you improve your unit test and style marks.

Getting Started

  1. Fork the assignment repository and create a project for it in VSCodium, following the same steps as in [Lab 2](/courses/comp1100/labs/02/. The assignment repository is at https://gitlab.cecs.anu.edu.au/comp1100/2022s1/2022s1studentfiles/assignment2.
  2. Add our version of the repository as a remote called upstream. This allows us to provide additional fixes in the unlikely case that they are required. You do this by doing the following:
    • Go to the command palette in VSCode (or VSCodium) by pressing Ctrl + Shift + p
    • Type git remote
    • Click Git: Add Remote
    • Enter upstream into the box for the remote name
    • Put the following URL as the remote url: https://gitlab.cecs.anu.edu.au/comp1100/2022s1/2022s1studentfiles/assignment2.git.

Overview of Tasks

This assignment is marked out of 100 for COMP1100, and out of 120 for COMP1130:

Task COMP1100 COMP1130
Task 1: Types and Helper Functions 25 20
Task 2: Implementing Cellular Automata 35 30
Task 3: Custom Automaton (COMP1130 Only) N/A 20
Unit Tests 10 10
Style 10 10
Technical Report 20 30

Overview of the Repository

For COMP1100 students, most of your code will be written in src/Automata.hs, and a little in src/TestPatterns.hs. You will also need to implement tests in src/AutomataTest.hs, which contains some example tests for you to study. COMP1130 students will also need to write code in src/App.hs.

Other Files

  • src/TestPatterns.hs contains some test patterns for the automata in this assignment.
  • src/Testing.hs is the testing library we used in Assignment 1. You should read this file as well as src/AutomataTest.hs, and make sure you understand how to write tests.
  • src/GridRenderer.hs contains code to render a grid of cells to the screen, and to convert a point on the screen back into a grid coordinate. You are not required to understand it, but it is heavily commented for interested students to read.
  • src/App.hs contains the bulk of a small CodeWorld test program that uses your automata code. We discuss its features in “Overview of the Test Program”.
  • app/Main.hs launches the test application.
  • test/Main.hs is a small program that runs the tests in src/AutomataTest.hs.
  • comp1100-assignment2.cabal tells the cabal build tool how to build your assignment. You are not required to understand this file, and we will discuss how to use cabal below.
  • Setup.hs tells cabal that this is a normal package with no unusual build steps. Some complex packages (that we won’t see in this course) need to put more complex code here. You are not required to understand it.

Overview of Cabal

As before, we are using the cabal tool to build the assignment code. The commands provided are very similar to last time:

  • cabal v2-build: Compile your assignment.
  • cabal v2-run automata: Build your assignment (if necessary), and run the test program.
  • cabal v2-repl comp1100-assignment2: Run the GHCi interpreter over your project.
  • cabal v2-test: Build and run the tests. This assignment is set up to run a unit test suite like in Assignment 1, but this time you will be writing the tests. The unit tests will abort on the first failure, or the first call to a function that is undefined.


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx