Beruflich Dokumente
Kultur Dokumente
Case Study
Conceptual Modeling of
Introduction
The Sudoku Puzzle
Sudoku is a logic-based placement puzzle. Although an early variant of the puzzle was published in a French newspaper in 1895, modern interest in Sudoku stems from a revival in Japan in 1986, leading to widespread international popularity in 2005. The attraction of the puzzle relies on the simplicity of its rules, yet the line of reasoning required to reach the solution may be complex. In a well-constructed Sudoku grid there is one and only one correct solution. The system modelled in this paper gives the capability of managing different users, playing with their sudokus and generating new ones.
System overview
Sudokus and players The system stores information about players and their generated sudokus (not completely solved yet or finished). Players can generate new sudokus or choose among unfinished sudokus of their own. Moreover, the system keeps a record of the number of errors made by each player. A player can start the resolution of a sudoku, stop it, and resume its resolution later. Generate new Sudokus Players can use the system in order to generate new sudokus with random values and unique solution. Playing with sudoku puzzles In sudoku puzzles, the goal is to write one number in each empty cell, so that each column, row, and region contains the numbers 19 exactly once. Obviously, these values can be correct or wrong. When all values in white cells are correct, the system knows that the sudoku is finished. Additional functionalities
33
During the resolution of a sudoku, players can doubt. The System supports the user by checking whether the value of a cell is correct or reporting the list of incorrect cells in a particular moment.
44
Links
More information about Sudoku puzzle can be found in : http://en.wikipedia.org/wiki/Sudoku http://www.sudoku.com Other software like sudoku solvers or generators can be downloaded following the links below : http://www.sudoku.com/download.htm http://www.kristanix.com/winsudoku/ http://www.gamealbum.com/keyword/sudoku/ http://www.arcadetown.com/ancientsudoku/game.asp http://ostermiller.org/qqwing/download.html http://sudoku-generator.en.softonic.com/ie/45776
55
System actors
User: All people who use the system. Registered User: All users who have provided their personal information to the system. Player: A player is a registered user with the capability of generating, saving and solving sudoku puzzles. Administrator: An administrator is a registered user who can administrate the System and create other Administration accounts.
66
77
0 1
A User creates a new player account in order to be able to use the system.
Primary actors
User
Preconditions
1. The User introduces the personal and the identification information required by the system. 2. The System creates a new Player with the information introduced by the User. The User becomes a RegisteredUser.
Alternative Scenario 1.a. The information introduced is not valid Extensions 1.a.1. The System notifies the user that the information is not valid.
02
Update Mail
Summary
Primary actors
RegisteredUser
Preconditions
88
1. The RegisteredUser changes his/her mail. 2. The System updates the mail according to the new information.
Alternative Scenario 1.a. The new mail is not valid Extensions 1.a.1. The System notifies the user that the new mail is not valid.
99
0 3
Primary actors
RegisteredUser
Preconditions
1. The User changes his/her identification information. 2. The System updates the identification information according to the changes.
Alternative Scenario 1.a. The new identification information is not valid Extensions 1.a.1. The System notifies the user that the identification information is not valid.
04
Remove User
Summary
Primary actors
RegisteredUser
Preconditions
Alternative Scenario 1.a. The RegisteredUser has unfinished Sudokus Extensions 1.a.1. The System removes all the Sudokus owned by the user.
0 5
Primary actors
Player
Preconditions
1. The System generates a random sudoku and saves it as a Sudoku owned by the Player. 2. The new sudoku becomes the current sudoku of the Player.
0 6
A Player indicates to the system that he/she wants to continue solving an unfinished sudoku previously started.
Primary actors
Player
Preconditions
1. The System shows the list of unfinished sudokus owned by the Player. 2. The Player chooses one of his/her unfinished sudokus. 3. The selected sudoku becomes the current sudoku of the Player.
Alternative Scenario 1.a. There are not unfinished sudokus owned by the player. Extensions 1.a.1. Use case ends.
0 7
Primary actors
Player
Preconditions
The Player has a current sudoku (new or not finished yet). 1. The Player selects a white cell. 2. The Player indicates to the system a value to be put in the selected cell. 3. The System puts the given value in the selected cell.
08
Check a Cell
Summary
Primary actors
Player
Preconditions
The Player has a current sudoku (new or not finished yet). 1. The Player selects a non empty white cell. 2. The System answers whether the value of the selected cell is correct or not.
0 9
Primary actors
Player
Preconditions
The Player has a current sudoku (new or not finished yet). 1. The System shows the white cells of the current sudoku that have an incorrect value.
1 0
Primary actors
Administrator
Preconditions
1. The Administrator introduces the personal and identification information of the new Administrator. 2. The System creates a new Administrator according to the information introduced.
Alternative Scenario 1.a. The information introduced is not valid Extensions 1.a.1. The System notifies Administrator that the information is not valid.
Conceptual Schema
Structural Conceptual Schema
{constant}
{constant}
{constant}
{constant} {constant}
{constant}
{constant}
{constant}
{constant}
Enumerations
<<Enumeration>>
RowCode
1 2 3 4 5 6 7 8 9
topRowOfRegion():Boolean
<<Enumeration>>
<<Enumeration>>
ColumnCode
1 2 3 4 5 6 7 8 9
leftColumnOfRegion ():Boolean
ValueCode
1 2 3 4 5 6 7 8 9
context RowCode::topRowOfRegion() : Boolean body: rowCode = 1 or rowCode = 4 or rowCode = 7 context ColumnCode::leftColumnOfRegion() : Boolean body: columnCode = 1 or columnCode = 4 or columnCode = 7
Integrity Constraints
!!
" "
"#
!!
!& '!
( &
( &
&*
$ '!-,
& /0 &
+ -, ( 01 2 + +
+/5)
( 01 6
!& &
3 ( 34(
&-,
) &*
&;
" , , , , , !
( &
! , ( !
% + " 63 ( / ) 1 34( '! ! %
!!
,
% ) *
3 ( 34(
! ,
& 3 ( 34(
!(
&%
!
) &* %
,
+
! ",
(
!
&
(> ! %
3 ( 34( &-, 6 % ) &* % + ? (4 " + " + +
"% % % ! :
! : 6 ! : 6 (> ! %
, :
! . +0
",
$ '!-,
&
+ ",
$ '!
&
+ 7 88
$ '!-,
'!%
&
+ ",
:( 3,
: /0
&
3 ( 34(
$ '!
(( :
&-,
) &* 1
(
/0
, ",
$ '! : # ( 6 ( 63 ( / + ,
$ '!-, % 1 '!% ( ) +
'!
( )
( 1
3,
: (
& :
3 ( 34(
&-, (6
!(
% :
) &*
% (
+0
*
(> ! % " "
3 (> ! %
( "'! !% (> ! % '!
"
"
!!
6 %
@
", % . 5
-,
Derivation rules
Class :
Sudoku
:: !
: !
,
,
:;
", , -, % ,
&
",
! :
? (4
"
::
3, $ !
:#
, !
&
",
Class :
"
Player
4
3,
::
$
:#
! $4 , $4 , ! , ,
&
"
Class :
WhiteCell
-,
3,
::
! -,
:*
% ,
A5 0B
! ,
&
! !
? (4
, ;4
/1
-,
3,
:: "
( ,
:;
"
A5 0B
! !! ! ,
&
! C !
? (4
"
/1
Class :
M o ve
D
:
:: "
"
:;
! , !! ! , !
&
C ",
Derived Associations
:: ",
-, % !
: -,
%
-, % ,
&
"
34( '! -,
%
3,
::
:
", , ( , " ! ,
&
" 4 ! ! ! ! 6 " " " " + C+ (> ! % " (> ! % " + (> ! % C+ (> ! % " " 9E 9E
Behavioural Schema
Introduction
In this section, we specify the dynamic view of the Basic Sudoku System, which consists of the specification in OCL of effects and integrity constraints associated to events. We classify the events in conceptual groups to improve its readability.
( 4
%,
&& !!
&
# " ( &
( 4
# "
&& !!
+
34( '!
( 4
%, $ 4&
&&
&;
4&
( 4 +
%,
&&
"
3, '"
'!
&;
# " ( &
+ ( " + + +(
&&
"
&
&;
# " ( &
(
4 && !!
# " ( 34( '! 4 @ : $ (
# ": ( &
@ :
# " $
&& !!
34( '! :
D ( &
&& !!
+
" ( &
%,
(
&& !!
" + " ( "
* ( &
# " ",
:%
%
&& !!
+ ",
34( '! D % + +
4&
( 4
:%
&& %
",
'!%
",
&;
2828
% ( &
" +
%,
&& !!
",
"
&
" +
%,
",
&& !!
"
? (4
% $ 4&
( 4
%,
&& %
",
&;
-,
% $ 4&
%,
&&
&;
%
2929
%,
&&
3, %
'!
&;
4&
( 4
3030