Unverified Commit 2e86d132 authored by Thomas R. Koll's avatar Thomas R. Koll
Browse files

Start with game code

parent 11b5bd92
#include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#define DEBUG 1
struct Player {
short score; // defaults o 0
short saturation; // their colour
int stones[6];
unsigned int field;
Player();
Player(unsigned int field) : field(field) {};
};
struct Stone {
int position; // where a stone is at right now
};
// two bit masks to with the board layout for each player
// starts with the each player's four outer fields, followed
// by the eight shared field and again each player's two outer finish fields
//
// 1 2 3 4 18 17
// 9 10 11 12 13 14 15 16
// 5 6 7 8 20 19
const unsigned int playerOneField = 0b11110000111111111100;
const unsigned int playerTwoField = 0b00001111111111110011;
const unsigned int protectedFields = 0b1111111110001; // it's just one field in the middle
void throwDice( int dice) {
dice = 0;
for (int i = 0; i < 3; i++ ) {
dice = (dice << 1) | (rand() % 2);
}
#ifdef DEBUG
printf("Thrown dice: %b", dice);
#endif
}
int moveStone(Player player, Stone stone, int value) {
}
int main() {
srand (time(NULL));
Player playerOne(playerOneField);
Player playerTwo(playerTwoField);
trowDice();
trowDice();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment