Departament de Llenguatges i Sistemes Informtics UNIVERSITAT POLITCNICA DE CATALUNYA
GMC Conceptual Modeling of information systems research Group
Case Study
Conceptual Modeling of
Albert Tort Pugibet atort@lsi.upc.edu Antoni Oliv
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
Use Case Specification
Introduction
In the following lines, we specify the functionalities offered by Basic Sudoku and what types of actors can initiate them.
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
Use Case Diagram
77
Use case specification
0 1
Create New Player
Summary
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.
Main Success Scenario
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.
1.a.2. The user changes the information.
02
Update Mail
Summary
A RegisteredUser changes his/her mail.
Primary actors
RegisteredUser
Preconditions
88
Main Success Scenario
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.
1.a.2. The user changes the mail again.
99
0 3
Change Identification Information
Summary
A RegisteredUser changes his/her identification information.
Primary actors
RegisteredUser
Preconditions
1. The User changes his/her identification information. 2. The System updates the identification information according to the changes.
Main Success Scenario
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.
1.a.2. The user changes the identification information.
04
Remove User
Summary
A RegisteredUser is removed from the system.
Primary actors
RegisteredUser
Preconditions
Main Success Scenario
1. The System removes the RegisteredUser account.
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
Generate a New Sudoku
Summary
The System generates a new Sudoku to be solved by the player.
Primary actors
Player
Preconditions
Main Success Scenario
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.
Alternative Scenario Extensions
0 6
Choose an unfinished Sudoku
Summary
A Player indicates to the system that he/she wants to continue solving an unfinished sudoku previously started.
Primary actors
Player
Preconditions
Main Success Scenario
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
Put a Value in a Cell
Summary
A Player puts a value (1-9) in a cell of the current sudoku.
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.
Main Success Scenario
Alternative Scenario Extensions
08
Check a Cell
Summary
The System checks whether the value of a selected cell is correct.
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.
Main Success Scenario
Alternative Scenario Extensions
0 9
Check Incorrect Cells
Summary
The system shows the incorrect cells of the current sudoku.
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.
Main Success Scenario
Alternative Scenario Extensions
1 0
Create New Administrator
Summary
An Administrator creates a new administrator account.
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.
Main Success Scenario
Alternative Scenario 1.a. The information introduced is not valid Extensions 1.a.1. The System notifies Administrator that the information is not valid.
1.a.2. The Administrator changes the information.
Conceptual Schema
Structural Conceptual Schema
{constant}
{constant}
{subsets owner} {constant}
{constant}
{constant} {constant}
{constant}
{constant}
{subsets container} {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 + +
&3 ( 34( &* % ) & 788 $ '!-, % 0 90 788 $ '!-, % 0
+/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 (> ! %
( "'! !% (> ! % '!
"
"
4 !& % & 3 ( 34( & "
& "% ) &% % ) &* % )( 1 + ) 34( ( 6 '! 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.
Game Choice Events
( 4
%,
&& !!
&
# " ( &
( 4
# "
&& !!
+
34( '!
( 4
%, $ 4&
&&
&;
4&
( 4 +
%,
&&
"
3, '"
'!
&;
User Management Events
# " ( &
+ ( " + + +(
&&
"
&
&;
# " ( &
(
4 && !!
# " ( 34( '! 4 @ : $ (
# ": ( &
@ :
# " $
&& !!
34( '! :
D ( &
&& !!
+
" ( &
%,
(
&& !!
" + " ( "
&& !! ( & # " $ 4& && # ? &;
6
Game Domain Events
* ( &
# " ",
:%
%
&& !!
+ ",
34( '! D % + +
4&
( 4
:%
&& %
",
'!%
",
&;
2828
Action Request Events
% ( &
" +
%,
&& !!
",
"
&
" +
%,
",
&& !!
"
? (4
% $ 4&
( 4
%,
&& %
",
&;
-,
% $ 4&
%,
&&
&;
%
2929
%,
&&
3, %
'!
&;
4&
( 4
3030