Formulation - practicum 3 (30.11)
This week you should start thinking about your individual project. At first, come up with an idea for the project and submit it (as a text file or pdf) before practical session 3.
During practical session 3, we will discuss the ideas in the class.
The program itself has to be released by practical session 5.
- The idea should be original - you should come up with it by yourself.
- The topic (subject) of the project should be interesting to you. This project can be a further development of your project from the course Introduction to Programming I.
- The workload is about 10h (trace the working hours on the project and submit it in a separate file together with the project).
- The program must have a simple graphical design (use tkinter, easygui etc.).
- The program must read data from a file or write data to a file.
- The program must contain a list, a dictionary, a tuple or a set (for getting maximum points, the program must contain a nested data structure).
- The program must contain a (nested) loop, a function, a conditional statement.
Try to come up with an idea which meets the requirements and does not sound very artificial. In a very special case, it is possible to substitute some requirements with alternatives (on approval of the instructor).
Before session 3, upload only the project formulation (a text file or pdf)! The formulation must contain a general idea and a purpose of the program. Also say some words about the data structures, files, functions, conditional statements and loops (where in the program they will be created and used).
Samples of project ideas
Here are some examples of the project (in complete absence of inspiration (which is unlikely), you can use them). These ideas contain only a description of the project; in the project formulation you also need to write where the data structures, files, functions, conditional statements and loops will be used. Be specific in the project formulation, e.g. how the program accesses the data - is it asked from the user? read from a file?
- Matches. At the beginning of the game, Python generates a random number. This number shows how many matches are on the table. The players take in turns one, two or three matches at a time. The player, who takes the last match, loses the game.
- Battle of the dragons. The program simulates a battle of two dragons.
- Dice. The players throw a dice. During one turn, a player can throw the dice as many times as he wants; the points are summed. However, if the dice shows 1, player's all points are annulled, and the dice is immediately given to the second player. The winner is a player who first gets 91 points.
- Memory game.
A sample of a complete project formulation
1. What should the program do?
This is my implementation of the Tic Tac Toe game. The program asks the user for two names: the first person will play for X and the second for O. Players take turns placing their X or O. The player who succeeds in placing three of his marks in a horizontal, vertical, or diagonal row, wins the game, and the program shows a message about that. If the board is filled up and there is no winner, the game ends in a draw (the program shows a message about that as well). Once a game is over, the program makes a record into the file about the winner or a tie.
2. How will GUI look like?
A picture will be drawn in some program, for example MS Paint.
There will be a graphical window with nine (3x3) buttons.
3. What can be given as an input?
The program will not read any data from file. The program will ask the user for two names.
4. What will be written to the file?
After every game, the program adds a record into the file about the winner or a tie.
5. Where to use a data structure?
There will be a matrix (a list of lists) to represent the status of one turn in the Tic Tac Toe game.
6. Where to use functions?
- There will be a function with one parameter for a list. The list will contain three elements. The function will return True if there are three O-s or three X-s in the list.
- There can be more functions in the program if needed.
7. Where to use a loop (for/while)?
I will use a for loop for composing and checking each row, each column and each diagonal of the matrix.
8. Where to use an if-else block?
- The function uses if-else to make sure if there are three O-s or three X-s in the list.
- Another if-else will be used inside the loops to invoke the function.