Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fp:homework04 [2022/05/05 08:41]
pdmatei
fp:homework04 [2023/05/09 15:27] (current)
pdmatei
Line 1: Line 1:
-===== H04Final homework ​=====+===== Homework 4Five in a row AI =====
  
-For the final homework, you **may** choose between two options: +Homework ​consists in developing a complete ​five-in-a-row game, together with an AI and a very basic interface. ​
-  * **A. Lab homework (0.5p)**. All students which **did not submit** ​Homework ​3, (or submitted a solution which did not compile or got under 30p), may choose this homework. The **maximum** number of points that may be achieved is 0.5p. See details below. +
-  * **(B) Tic Tac Toe part 2 (1p)**. All students which **submitted** Homework 3 or a consistent part of it may choose this homework. See details below. +
- +
-  * Deadline (for both options): **Friday 27 May** +
- +
-===== A. Lab homework (0.5p) ===== +
- +
-The lab homework ​consists in providing **complete** solutions to labs [[fp:​lab04|4]],​ [[fp:​lab05|5]],​ [[fp:​lab06|6]],​ [[fp:​lab07|9]] and [[fp:​lab08|10]],​ except for exercises marked with **(!)**.  +
-  * **Each completed lab will be graded with 0.1p**  +
-  * **There will be no partial points for partially solved labs** ​each lab has to be entirely complete to be graded. +
-  * **Solutions will be presented live and graded during lab** no solutions sent by email or MS Teams will be graded. +
-  * **Solutions should be solved 100% individually**. If some exercises or **parts** of them are taken from other sources, the **entire homework** will not be graded. +
- +
- +
- +
-===== B. Tic Tac Toe part 2 (1p) ===== +
- +
-Option B. for Homework 4 consists in developing ​complete Tic Tac Toe game, together with an AI and a very basic interface. ​+
  
   * For this stage, you will decide on the structure of your project, as well as write tests to guide your implementation.   * For this stage, you will decide on the structure of your project, as well as write tests to guide your implementation.
Line 26: Line 8:
   * There will be no other partial points, other than those mentioned explicitly in the statement.   * There will be no other partial points, other than those mentioned explicitly in the statement.
  
-==== B.1. Board analysis (0.2p) ====+==== 4.1. Board analysis (0.2p) ====
  
-For this part, you need to implement a function ''​sequences'',​ that returns a map of the form: ''​(a,5), (b,4), (c,3), (d,2)''​ where:+For this part, you need to implement a function ''​sequences'',​ that returns a map of the form: ''​(5,a), (4,b), (3,c), (2,d)''​ where:
   * ''​a''​ is the number sequences of length 5 that the player has established (on lines, columns or diagonals).   * ''​a''​ is the number sequences of length 5 that the player has established (on lines, columns or diagonals).
   * ''​b''​ is the number of sequences of length 4 **which can be filled-out in order to achieve a 5-sequence**. For example: ''​XX XX''​ is such a sequence for player ''​One'',​ however ''​XX0XX''​ is not, since this cannot be filled-out in order to achieve a 5-sequence.   * ''​b''​ is the number of sequences of length 4 **which can be filled-out in order to achieve a 5-sequence**. For example: ''​XX XX''​ is such a sequence for player ''​One'',​ however ''​XX0XX''​ is not, since this cannot be filled-out in order to achieve a 5-sequence.
Line 34: Line 16:
  
   * Proper testing is **essential** for this function, as the AI will take decisions based on it. It will be harder to spot problems with ''​sequences''​ in a later stage of the project.   * Proper testing is **essential** for this function, as the AI will take decisions based on it. It will be harder to spot problems with ''​sequences''​ in a later stage of the project.
-  * You can replace the implementation of ''​winner''​ with a call to this function, to make the code more compact and avoid partial re-implementations+  * You can replace the implementation of ''​winner''​ with a call to this function, to make the code more compact and avoid partial re-implementations.
  
 <code scala> <code scala>
Line 40: Line 22:
 </​code>​ </​code>​
  
-==== B.2. Functionality (0.35p) ==== +==== 4.2. Functionality (0.35p) ==== 
  
 For this part, you need to implement a functional project which consists of a running loop: For this part, you need to implement a functional project which consists of a running loop:
Line 51: Line 33:
 ** For this particular part, tests are not necessary**. ** For this particular part, tests are not necessary**.
  
-==== B.3. Game AI (0.45p) ==== +==== 4.3. Game AI (0.45p) ==== 
  
 This part is at the very core of the project, and essentially consists of a function ''​play'',​ which implements the AIs decision of selecting a move. This part is at the very core of the project, and essentially consists of a function ''​play'',​ which implements the AIs decision of selecting a move.
Line 60: Line 42:
 **You may slightly change the signature of this function**, to accommodate your project. **You may slightly change the signature of this function**, to accommodate your project.
  
-You may start with a very basic (trivial) implementation,​ which will allow you to move on with **B.2.** and then refine it after **B.2.** is complete.+You may start with a very basic (trivial) implementation,​ which will allow you to move on with **4.2.** and then refine it after **B.2.** is complete.
  
 We offer no guidelines about how this function should be implemented,​ this is entirely up to you, but you may consider: We offer no guidelines about how this function should be implemented,​ this is entirely up to you, but you may consider:
Line 73: Line 55:
   * Minimax-based AI **0.45p**   * Minimax-based AI **0.45p**
  
-==== B.4. Bonus (0.2p) ====+==== 4.4. Bonus (0.2p) ==== 
 + 
 +During the last lecture, we will play a tournament of Five-in-a-row,​ in which all your AI programs will compete.
  
-During ​the last lecture, we will play tournament ​of Tic-Tac-Toe,​ in which all your AI programs will compete.+**The author ​the best AI implementations ​will be awarded ​bonus of 0.2p**.
  
-**The author ​of the best AI will be awarded ​bonus of 0.2p**.+** The winner ​of the tournament ​will receive ​maximal grade of 10 for the entire lecture (no attendance to the exam will be necessary)**.