All exercises should be completed. Some will be submitted (see below). We will try to give feedback on those that are submitted. Only a subset of those you submit will be graded and count towards the CA mark.

Submissions have strict due dates. Late work will not be accepted unless under extreme and verifiable circumstances.

CS2514 Lab 1

Exercise A

In a file called Nim.java, write a main method to play the following version of the game of Nim:

Include enough print/println statements so that the user knows what's going on.

Exercise B

Take a copy of the following file (right-click on the link and choose 'Save link as…'):

Based on NameTester.java, write a class definition for Name.

Submission

Deadline: 4pm, Friday 29th January 2016.

Submit your solution to Exercise A only. Open a console; use the cd command to move to where your solution is and type:

                submit-2514 Nim.java
            

Challenge exercise

Remember that challenge exercises are always optional. They do not form part of your year's work and they are not worth any marks. They are designed for those students who finish the main exercise quickly and easily, and wish to explore further. You may need to use things not covered so far in lectures.

When you are convinced that your Nim program is superb (correct, efficient, elegant), make a copy of it in NimChallenge.java. Modify it as follows so that the computer now plays 'smart'.

The computer is still subject to the rule that it must pick up at least one and at most half of the matchsticks but now...

Call me over to look over your challenge solution.