Format and typo fix 2013/morgan2/README.md
This commit is contained in:
1 parent
1e00b808ec
commit
f2b90a55ad
1 file changed
+40
-30
+40
-30
@@ -1,7 +1,7 @@
|
|||||||
# Most playfully versatile
|
# Most playfully versatile
|
||||||
|
|
||||||
Yves-Marie Morgan
|
Yves-Marie Morgan<br>
|
||||||
<yves-marie.morgan@parrot.com>
|
<yves-marie.morgan@parrot.com>
|
||||||
|
|
||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
@@ -31,15 +31,16 @@ echo "Do or do not. There is no try."
|
|||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
The judges enjoyed playing the game almost to completion; if we remember correctly,
|
The judges enjoyed playing the game almost to completion; if we remember
|
||||||
we managed to place 59 or 60 dominoes. We wonder, what would be faster: to play the game to completion
|
correctly, we managed to place 59 or 60 dominoes. We wonder, what would be
|
||||||
or to write an unobfuscated version of it?
|
faster: to play the game to completion or to write an unobfuscated version of
|
||||||
|
it?
|
||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
This program is a domino game. The goal is to place dominoes on the 8x8 grid.
|
This program is a domino game. The goal is to place dominoes on the 8x8 grid.
|
||||||
Each domino is made of 6 squares of the color red or green. To place a domino,
|
Each domino is made of 6 squares of the colour red or green. To place a domino,
|
||||||
at least one of it side shall match the other side of another domino.
|
at least one of its side shall match the other side of another domino.
|
||||||
|
|
||||||
### How to play
|
### How to play
|
||||||
|
|
||||||
@@ -47,14 +48,14 @@ at least one of it side shall match the other side of another domino.
|
|||||||
|
|
||||||
At the start of the game, the first domino is placed randomly on the grid. You
|
At the start of the game, the first domino is placed randomly on the grid. You
|
||||||
get another domino to place by selecting one empty position in the stack on the
|
get another domino to place by selecting one empty position in the stack on the
|
||||||
right. You can have to 8 dominoes pending at any time.
|
right. You can have up to 8 dominoes pending at any time.
|
||||||
|
|
||||||
### Moving in the stack
|
### Moving in the stack
|
||||||
|
|
||||||
Use `Up` and `Down` key to move the cursor in the stack. Press `Enter` to either
|
Use `Up` and `Down` key to move the cursor in the stack. Press `Enter` to either
|
||||||
|
|
||||||
* reveal a new domino if the position was empty.
|
* Reveal a new domino if the position was empty.
|
||||||
* select the domino to try to place it if the position was not empty.
|
* Select the domino to try to place it if the position was not empty.
|
||||||
|
|
||||||
The currently selected domino is indicated on the top right.
|
The currently selected domino is indicated on the top right.
|
||||||
|
|
||||||
@@ -66,19 +67,20 @@ to place the domino.
|
|||||||
|
|
||||||
To go back to selection mode, press `Enter` on an occupied position.
|
To go back to selection mode, press `Enter` on an occupied position.
|
||||||
|
|
||||||
The domino can be place in an empty position if all its neighbour have matching
|
The domino can be placed in an empty position if all its neighbour have matching
|
||||||
sides and the domino has at least one neighbour.
|
sides and the domino has at least one neighbour.
|
||||||
|
|
||||||
### Scoring
|
### Scoring
|
||||||
|
|
||||||
First, depending on the number of dominoes pending in the stack, a bonus is
|
First, depending on the number of dominoes pending in the stack, a bonus is
|
||||||
accorded :
|
accorded :
|
||||||
|
|
||||||
* 1 domino in the stack : 8 points.
|
* 1 domino in the stack : 8 points.
|
||||||
* 2 dominoes in the stack : 4 points.
|
* 2 dominoes in the stack : 4 points.
|
||||||
* 3 or 4 dominoes in the stack : 2 points.
|
* 3 or 4 dominoes in the stack : 2 points.
|
||||||
* 5 or more dominoes in the stack : 0 point.
|
* 5 or more dominoes in the stack : 0 points.
|
||||||
|
|
||||||
Then the bonus is multiplied by the number of matching neighbor the placed domino
|
Then the bonus is multiplied by the number of matching neighbours the placed domino
|
||||||
has (1, 2, 3 or 4). This is added to the score.
|
has (1, 2, 3 or 4). This is added to the score.
|
||||||
|
|
||||||
Finally, the total score is divided by the number of dominoes placed (1 - 64).
|
Finally, the total score is divided by the number of dominoes placed (1 - 64).
|
||||||
@@ -88,24 +90,25 @@ final score (total score divided by fill count).
|
|||||||
|
|
||||||
### End of the game
|
### End of the game
|
||||||
|
|
||||||
The game is finished when no more domino can be placed and you either :
|
The game is finished when no more dominos can be placed and you either :
|
||||||
* filled the complete grid.
|
|
||||||
* have 8 pending dominoes in the stack.
|
* Completely filled the grid.
|
||||||
* no more domino can be revealed in the stack (more than 56 dominoes placed on
|
* Have 8 pending dominoes in the stack.
|
||||||
|
* No more domino can be revealed in the stack (more than 56 dominoes placed on
|
||||||
the grid).
|
the grid).
|
||||||
|
|
||||||
**Note** There is no real end of game detection implemented in the program,
|
**Note**: There is no real end of game detection implemented in the program,
|
||||||
simply press `q` when you have finished...
|
simply press `q` when you have finished...
|
||||||
|
|
||||||
### Strategy
|
### Strategy
|
||||||
|
|
||||||
* Try to minimize the number of dominoes revealed in the stack. The lower the number,
|
* Try to minimize the number of dominoes revealed in the stack. The lower the
|
||||||
the higher the bonus.
|
number, the higher the bonus.
|
||||||
* Each domino is unique and all combination of colors exists, so keep track
|
* Each domino is unique and all combination of colours exists, so keep track
|
||||||
of what is already place and what is left.
|
of what is already placed and what is left.
|
||||||
* Make sure you don't render dead some positions by preventing a future placement
|
* Make sure you don't render dead some positions by preventing a future
|
||||||
If the corner of domino does not match another corner in diagonal, the move
|
placement. If the corner of a domino does not match another corner diagonally,
|
||||||
is valid but will prevent some future moves.
|
the move is valid but will prevent some future moves.
|
||||||
|
|
||||||
### Limitations
|
### Limitations
|
||||||
|
|
||||||
@@ -118,15 +121,22 @@ the higher the bonus.
|
|||||||
* 1 letter identifier, reused when possible.
|
* 1 letter identifier, reused when possible.
|
||||||
* 1 algorithm, 2 different kind of display (ncurses and X11) mixed.
|
* 1 algorithm, 2 different kind of display (ncurses and X11) mixed.
|
||||||
* No parameters to functions, all variables are global and shared.
|
* No parameters to functions, all variables are global and shared.
|
||||||
* Some variables are not initialized if they have a known value at the time of use.
|
* Some variables are not initialized if they have a known value at the time of
|
||||||
|
use.
|
||||||
|
|
||||||
### Compilation warnings
|
### Compilation warnings
|
||||||
|
|
||||||
with gcc 4.7.2 on Linux Ubuntu 12.10 :
|
With gcc 4.7.2 on Linux Ubuntu 12.10 :
|
||||||
* prog.c:46:65: warning: value computed is not used [-Wunused-value]
|
|
||||||
|
|
||||||
with clang 3.1 on Linux Ubuntu 12.10 :
|
```
|
||||||
* prog.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
|
morgan2.c:46:65: warning: value computed is not used [-Wunused-value]
|
||||||
|
```
|
||||||
|
|
||||||
|
With clang 3.1 on Linux Ubuntu 12.10 :
|
||||||
|
|
||||||
|
```
|
||||||
|
morgan2.c:23:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
|
||||||
|
```
|
||||||
|
|
||||||
**!!!!! HAVE FUN !!!!!**
|
**!!!!! HAVE FUN !!!!!**
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user