Propositional Logic / Clue

Table of Contents

This is a pair assignment, which means that if you are working on a team with someone else, you and your partner should do your best to engage in the pair programming model. At any point in time, one of you is “driving,” i.e. actually using the keyboard and mouse. The other is actively engaged following along, preventing bugs, and providing ideas.

You should not divide the work into individual pieces. In other words, you should not split the assignment and work on different portions. Likewise, you should not work on the assignment without both of you being present.

You should make sure that over the course of an assignment that you spend roughly the same amount of time each “driving.” I will also ask you to turn in a form rating the work that your partner does. My recommendation is to take turns approximately every 15 minutes or so. Set a timer to help you remember.

If you are working in a pair, only one of you needs to submit your work via Moodle.

Optional warmup

Check out the Clue game board that I’ve left in Olin 306/308. Stop in with friends (they don’t have to be in the class) and play a game.

The actual assignment

Read section 8 of the clue handout. Complete code for the initialClauses function in clueReasoner.py, as well as the hand, suggest, and accuse functions. Turn in the entire clueReasoner.py file.

Determining correctness

If you have written your code correctly, you will be able to run clueReasoner.py, and it will show a Clue scorecard showing where all the cards have landed. Each row will have one Y, and this will be true both before and after calling accuse. If your code is doing this, you are definitely close.

However, this is not sufficient for determining if your code is correct. To do that, the grader will run your functions (initialCauses, hand, suggest, accuse) separately, and see if they produce the same set of clauses that my solution does. I’m not going to supply this for you, as I would like part of this assignment to be for you to think through how to test this appropriately. My advice is to work through each of the functions and, for debugging purposes, print out the clauses you have added to see if you have done the right thing. I found it helpful to write a function to convert numbers back to player/card abbrebiations, in particular, as it made my debugging output easy to read.

You will receive a grade of M (meets expectations) for this assignment if…

  • when the grader runs each of your functions on test data, that it produces nearly the same set of clauses that my solution does. Duplicates are ok, and we’ll sort them ourselves so you don’t need to worry about the ordering. “Nearly” means the grader can look at it and decide that it’s clear that the results are close, but you missed one or two details on one of the functions.
  • your code clearly is generalized to solve the problem at hand, and isn’t doing something unreasonable like hard-coding in solutions to the test examples I provided.

You will receive a grade of E (exemplary) for this assignment if you satisfy the above M requirements, and …

  • the clauses produced by your code perfectly matches the one produced by my solution (again, dups are ok and order doesn’t matter)
  • your code demonstrates a clear sequence of actions to achieve the goal at hand, and each piece is essential. Your code does not have notably more cases or conditions than it needs to.
  • your code is not excessively verbose. Most of what you need to do should be doable with loops or nested loops. You shouldn’t have lines of code copied 6 times for each player, or something like that. Though you don’t need to use them, Python list comprehensions are a neat bonus.