Difference between revisions of "Sudoku"
From BP Wiki
(Created page with "= Sudoku = In this example one can see two properties of behavioral programming * How different heuristics and pieces of knowledge about the problem domain can be used separ...") |
|||
| Line 1: | Line 1: | ||
| − | = Sudoku = | + | = Sudoku = |
| − | In this example one can see two properties of behavioral programming | + | In this example one can see two properties of behavioral programming |
| − | * How different heuristics and pieces of knowledge about the problem domain can be used separately to program an application | + | * How different heuristics and pieces of knowledge about the problem domain can be used separately to program an application |
* How model-checking can be used to help find a desired scenario. | * How model-checking can be used to help find a desired scenario. | ||
| − | = Requirements = | + | = Requirements = |
| − | In the cells of a 9X9 grid which is also divided into 9 3X3 boxes, place the digits 1-9 such that in each row, column and box, each digit appears exactly once. | + | In the cells of a 9X9 grid which is also divided into 9 3X3 boxes, place the digits 1-9 such that in each row, column and box, each digit appears exactly once. |
= Events = | = Events = | ||
* Move: A single event class with 9X9X9 = 721 instances. The class has 5 data fields: | * Move: A single event class with 9X9X9 = 721 instances. The class has 5 data fields: | ||
| − | ** number: the number written in the cell (1-9) | + | ** number: the number written in the cell (1-9) |
| − | ** row: The row of the cell (1-9) | + | ** row: The row of the cell (1-9) |
** col: the column of the cell (1-9) | ** col: the column of the cell (1-9) | ||
| − | ** boxrow: The row of the 3X3 box in which this cell resides (1-3) | + | ** boxrow: The row of the 3X3 box in which this cell resides (1-3) |
| − | ** boxcol: the column of the 3X3 box in which this cell resides (1-3) | + | ** boxcol: the column of the 3X3 box in which this cell resides (1-3) |
| + | The triggering of the event symbolizes the writing of the digit in the associated cell. | ||
| − | |||
| − | + | == b-threads == | |
| − | == b-threads == | + | |
* DefaultMove: Each of the 81 instances of this b-thread class, is associated with a cell, and requests all possible 9 digits | * DefaultMove: Each of the 81 instances of this b-thread class, is associated with a cell, and requests all possible 9 digits | ||
Revision as of 11:18, 15 April 2014
Contents
Sudoku
In this example one can see two properties of behavioral programming
- How different heuristics and pieces of knowledge about the problem domain can be used separately to program an application
- How model-checking can be used to help find a desired scenario.
Requirements
In the cells of a 9X9 grid which is also divided into 9 3X3 boxes, place the digits 1-9 such that in each row, column and box, each digit appears exactly once.
Events
- Move: A single event class with 9X9X9 = 721 instances. The class has 5 data fields:
- number: the number written in the cell (1-9)
- row: The row of the cell (1-9)
- col: the column of the cell (1-9)
- boxrow: The row of the 3X3 box in which this cell resides (1-3)
- boxcol: the column of the 3X3 box in which this cell resides (1-3)
The triggering of the event symbolizes the writing of the digit in the associated cell.
b-threads
- DefaultMove: Each of the 81 instances of this b-thread class, is associated with a cell, and requests all possible 9 digits