Assignment 1

Due: Please add, commit and push at least 4 times, and by the dates below.
  • September 28 by 11:59 pm: HumanVSHuman complete, including all needed supporting classes.
  • October 1 by 11:59 pm: All other controllers complete, including all supporting classes.
  • October 6 by 11:59 pm: randomVsRandomReport.txt
  • October 10 by 11:59 pm: Final version of project
Late penalty:20% if handed in up to 48 hours late. Not accepted after that. Please notify me by email if you are handing in late. Otherwise we will not check your code out of the repository for marking.
Hand in: Electronic submit via git, that is, you should have your code checked into your repository by the due date. We will check it out from there.
Make sure to ALSO add the COMMIT ID that you want marked to csc207 which commit.

For example, if I wanted the Oct 2 11:50:30 commit marked, I would enter 0af8e118ce4986e42576dbd8794d0ea1a7d549b3 in the a1 Commit ID field in whichCommit. $ git log commit b5a835036b5220674d81fc95346f12692c0ce747 (HEAD -> master, origin/master, origin/HEAD) Author: arnold <arnold@Ubuntu22.04> Date: Wed Oct 2 12:07:30 2024 -0400 update w04.zip commit 0af8e118ce4986e42576dbd8794d0ea1a7d549b3 Author: arnold <arnold@Ubuntu22.04> Date: Wed Oct 2 11:50:30 2024 -0400 update to w04.zip and w05.zip
Marking: The Marking Scheme for a1. The intent is that it is in line with my 5 mark grading scheme. For programs, I usually use my code marking scheme.
Groups: Groups of size 1.

Othello

You will implement the two player game Othello. Your implementation will include a whole collection of features, including You can find starter code in your assignment repo, repo_a1_$USER. Your job will be to complete the supplied classes using Java features to effectively create simple, clear, concise code. If it just works, but is not simple, clear, concise, your mark will be at most 80%. You should use OO features such as inheritance, interfaces, abstract classes as appropriate to create flexible code without duplicating code. You may not remove methods provided, you can add more private methods if you like and modify protections if it makes sense. You can also add additional classes and move method bodies to super classes etc. Use static and instance variables/methods as appropriate, with appropriate protections. Appropriately document your code.

Test Cases

We have provided some JUnit test cases in your Assignment1 project. To run them in IntelliJ, right click on src/test/java and then run "All Tests". When finished, all testcases should pass.

Sample Outputs

This section gives you some sample inputs and outputs to test your code against.

Tasks and Submit Schedule

Remember, something will go wrong, it always does! Please add, commit and push according to the following schedule. You should actually add, commit and push more often than suggested below! Being ahead of schedule is great, being behind may be an indication of trouble!
  1. Finish all easy methods in class OthelloBoard otherPlayer, validCoordinate, getCount, ...
  2. Work on medium methods in class OthelloBoard alternation, ...
  3. Work on hard methods in class OthelloBoard flip, hasMove, move, ...
  4. Work on methods in class Othello. The goal is to get the Othello.main running.
  5. Once Othello.main works, OthelloControllerHumanVSHuman.main should work! Try playing yourself etc.
  6. Commit and push: 'Completed OthelloControllerHumanVSHuman'
  7. Implement PlayerGreedy, then OthelloControllerHumanVSGreedy.
  8. Implement PlayerRandom, then OthelloControllerHumanVSRandom.
  9. Implement OthelloControllerRandomVSGreedy.
  10. Implement OthelloControllerRandomVSRandom.
  11. Commit and push: 'Completed all other Controllers'
  12. complete randomVsRandomReport.txt
  13. Commit and push 'Completed randomVsRandomReport.txt'
  14. Refactor, make sure code is simple, clear, concise, nice, all documentation is great.
  15. Commit and push 'Completed Assignment1'

Environment

You should build and run your code using IntelliJ, in the lab we have IntelliJ. Code that does not run in this environment, on lab systems, will not be marked! We are using Java 22 for this assignment. Please do not use any other java version.

You can clone repo_a1_$USER directly from IntelliJ.

/opt/opt/idea-IC-252.23892.409/bin/idea File -> New -> Projects from Version Control Use the following URL: ($USER is your utorid) https://mcsscm.utm.utoronto.ca:9999/git/207/25f/repo_a1_$USER.git Once the project is downloaded, a dialog will popup on the bottom right asking if you want to load the Maven project. Click it.

Questions and Answers

Question:
Can I have some examples for the flip method?
Answer:
Testing flip method: before 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ 0|O|O|O|O|O|O|O| |0 +-+-+-+-+-+-+-+-+ 1| |O|O|O|O|O|O|O|1 +-+-+-+-+-+-+-+-+ 2| | |O|O|O|O|O|X|2 +-+-+-+-+-+-+-+-+ 3| | | |O|O|O|O|X|3 +-+-+-+-+-+-+-+-+ 4| | | | |X|O|O|X|4 +-+-+-+-+-+-+-+-+ 5| | | | | |O|O|X|5 +-+-+-+-+-+-+-+-+ 6| | | | | | |O|X|6 +-+-+-+-+-+-+-+-+ 7| | | | | | | |X|7 +-+-+-+-+-+-+-+-+ 0 1 2 3 4 5 6 7 flip(0,4,0,1, P1)=-1 flip(1,4,0,1, P1)=-1 flip(2,4,0,1, P1)=3 flip(3,4,0,1, P1)=3 flip(4,4,0,1, P1)=0 flip(5,4,0,1, P1)=-1 flip(6,4,0,1, P1)=-1 flip(7,4,0,1, P1)=-1 Testing flip method: after 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ 0|O|O|O|O|O|O|O| |0 +-+-+-+-+-+-+-+-+ 1| |O|O|O|O|O|O|O|1 +-+-+-+-+-+-+-+-+ 2| | |O|O|X|X|X|X|2 +-+-+-+-+-+-+-+-+ 3| | | |O|X|X|X|X|3 +-+-+-+-+-+-+-+-+ 4| | | | |X|O|O|X|4 +-+-+-+-+-+-+-+-+ 5| | | | | |O|O|X|5 +-+-+-+-+-+-+-+-+ 6| | | | | | |O|X|6 +-+-+-+-+-+-+-+-+ 7| | | | | | | |X|7 +-+-+-+-+-+-+-+-+ 0 1 2 3 4 5 6 7
Question:
Can I see an example of OthelloBoard.alternation and OthelloBoard.hasMove?
Answer:
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ 0|O|O|O|O|O|O|O| |0 +-+-+-+-+-+-+-+-+ 1| |O|O|O|O|O|O|O|1 +-+-+-+-+-+-+-+-+ 2| | |O|O|X|X|X|X|2 +-+-+-+-+-+-+-+-+ 3| | | |O|X|X|X|X|3 +-+-+-+-+-+-+-+-+ 4| | | | |X|O|O|X|4 +-+-+-+-+-+-+-+-+ 5| | | | | |O|O|X|5 +-+-+-+-+-+-+-+-+ 6| | | | | | |O|X|6 +-+-+-+-+-+-+-+-+ 7| | | | | | | |X|7 +-+-+-+-+-+-+-+-+ 0 1 2 3 4 5 6 7 Testing alternation: alternation(0,0,0,1)= alternation(1,1,0,1)= alternation(2,2,0,1)=X alternation(3,3,0,1)=X alternation(4,4,0,1)=O alternation(5,5,0,1)=X alternation(6,6,0,1)=X alternation(7,7,0,1)= alternation(0,-1,0,1)= alternation(1,0,0,1)= alternation(2,1,0,1)= alternation(3,2,0,1)= alternation(4,3,0,1)= alternation(5,4,0,1)= alternation(6,5,0,1)= alternation(7,6,0,1)= Testing hasMove: hasMove(0,0,0,1)= hasMove(1,1,0,1)= hasMove(2,2,0,1)= hasMove(3,3,0,1)= hasMove(4,4,0,1)= hasMove(5,5,0,1)= hasMove(6,6,0,1)= hasMove(7,7,0,1)= hasMove(0,-1,0,1)= hasMove(1,0,0,1)= hasMove(2,1,0,1)=X hasMove(3,2,0,1)=X hasMove(4,3,0,1)=O hasMove(5,4,0,1)=X hasMove(6,5,0,1)=X hasMove(7,6,0,1)=
Question:
In JUnit5 tests, is the setup method run before each test?
Answer:
Yes.
Question:
For OthelloBoardTest, what does the setup method do?
Answer:
See othelloBoardSetup.txt
Question:
About the submit schedule...
Answer:
Your goal should be working code by the intermediate deadlines. If it is not completely working, submit what you have no matter what. You can fix code and submit later as well, up until the final due date. We will be marking your attempt to adhere to the submit schedule separately from the final, working version of the code. We will check that you add, commit and push by the required dates. Some marks for just doing that with serious effort put into the code. More marks if the tests/mains work as described. This is a smaller fraction of the marks for the project. Most marks will be for the final state of the code.
Question:
How much of the code can I change?
Answer:
You should not break any of the tests, not break any of the mains. You should modify the code to make it better, add methods, classes, modify access to methods, change things to/from static as it makes sense. Only do it if it makes the code better, but do it if it makes it better.
Question:
How did you setup JUnit5 tests?
Answer:
I added the following to pom.xml <dependencies> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.10.2</version> <scope>test</scope> </dependency> </dependencies> and then Maven->Reload Project to cause the dependencies to download. You can see the extra libraries in External Libraries.