The Sudoku is a simple visual game in which you need to be ableto fulfill tiles not repeating values that must be unique in therow, column or grid. Some references for this game can be foundeasily on the internet. For instance, you can play an interestingversion using the following site: https://www.websudoku.com/ ❖ Inshort, each row, column or grid indicates a sequence of numbersthat are varying from a range using different chars2 . ❖ The gamemust have two modes: “design” and “play”, where you canrespectively, create and starting playing the game. ➢ In the designmode, the initial board is completely “blank” and the user mustconsider the logic to be able to select appropriately the correctdistribution of values in the tiles. ▪ In this case, when the gameis complete (respecting the rules), it should be possible to hidethis solution – to be used later as a valid game configuration. ➢In the play mode, depending on the difficulty level (ex: “easy”,“medium” or “hard”), some data (tile values) are shown, but somewill be hidden. ▪ The problem is that in this second mode, theplayer must remember to select / type the values of the tilerespecting the rules of the game. • If the player is selecting acorrect value (not repeated in row, nor column, neither grid),he/she is increasing his/her punctuation. If not, the points willbe decremented.
Class GameController The class GameController will assemble theUI, primarily in its default constructor. You can consider it as aninner class called Controller. You will use it to manage the visualcomponents. The Controller class will have very basic code. Itreads the action command (or JavaFX equivalent) and will developthe Sudoku in the two different modes above described (“design” or“play”). When one value is selected, a logic function will beinvoked to check if it is ok and will let it be included in theconfiguration. Some basic behaviors: ❖ All components must have aunique action command, but the way that you can select the mode aswell as the strategy to be used in the game can vary freely. Forexample: ➢ You can use menus or choices or dialogs to define themode initially. ➢ The Sudoku itself can be composed by buttons, orlabels, or text fields. ❖ Some notes: • NOTE 1: o If you are usingSwing, GameController should extend JFrame. You may have to defineyour JFrame parameters in GameController instead of the Sudokuclass. o If you are using JavaFX, GameController may extend Scene,Pane or any descended Pane subclass as you see fit.
The Game must let you perform some actions:
• Select the mode: “Design” or “Play”.
• Define the dimension: This value can vary according to onespecific range (ex: 2 to 4). Remember, that it means that theinterface must be dynamically configured. Sudoku in differentsquare configurations (dim=2, dim=3 and dim=4)
• Show/Hide: Using this control, you can exhibit the completesolution (created by design) or hide it to start the game3 .
• Difficulty level: Where you are supposed to define differentways to show/hide data from the current game configuration. Theapproach suggested is: o Random configuration: Use random numbersto evaluate if one specific tile is supposed to show or hide itsvalue. Ex: consider these probabilities:
▪ Easy difficulty: About 25% of data is hidden; ▪ Mediumdifficulty: About 50% of data is hidden;
▪ Hard difficulty: About 75% of data is hidden.
• Additional elements:
Your interface must also contain:
o Image logo: Small button with image that can open a dialogwith “About” message.
o Points: Showing the points at this moment.
o History Area (not mandatory): To describe the sequence ofactions performed by the user.
In the future, you need to be able to persist the solution inone specific file (that can also be loaded by any player) using onespecific configuration – that will compose the model to be used inthe MVC solution.
o Time: To show the number of seconds since the beginning ofgame (to be implemented later).
o Reset button: To restart the game.
1.4.2. Initial Behavior Once selected the Design mode, the usermust be able to define a correct configuration for Sudoku.
❖ It means that you must let the user to create anyconfiguration in the game respecting the rules:
➢ Do not let the user to include invalid values and/or repeatedvalues.
➢ When you finish this configuration, let the player save it forfuture execution4 .
➢ Optionally, while an action is performed, if you have a panel(“history area”), you can provide additional info about what ishappening
Ex: … Tile(0,2) selected; New configuration: 2,23414123321_1432…
We have general restrictions:
• All classes must belong to one specific package(“sudoku”).
Remember that right now, your configuration can be saved in thememory using and “pattern” that you can use.
• TIP: This layout uses Java’s default look and feel.
• The frame (or stage) must not be resizable.
• Your name / team name must appear in the title bar.
• You may use BorderLayout, FlowLayout and GridLayout (or theJavaFX equivalent).
• This UI must be assembled manually.
o The use of UI builders is not permitted this time and willimply in deductions
The Sudoku is a simple visual game in which you need to be able to fulfill tiles not repeating values that must be uniqu
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am