You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.5 KiB

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "api.h"
struct stockage {
unsigned int nb_joueur;
enum hole_t color;
struct stockage storage(unsigned int write, unsigned int nb_joueur, enum hole_t color) {
static struct stockage stock= {0, none};
if(write & 1)
stock.color = color;
if(write & 2)
stock.nb_joueur = nb_joueur;
return stock;
void InitLibrary(char name[50]) {
struct stockage stock;
stock = storage(3,0,0);
printf("name for player (color %d)?", stock.color);
scanf("%s", name);
printf("stratégie init %s\n", name);
void StartGame() {
puts("stratégie start game");
void StartMatch(const unsigned int nb_joueur, const enum hole_t color) {
struct stockage stock;
stock = storage(3,nb_joueur, color);
printf("stratégie start match (%d players, color%d)\n", stock.nb_joueur, stock.color);
void EndMatch() {
puts("stratégie end match");
void EndGame() {
puts("stratégie end game");
int NextMove(const SGameState * const gameState, int firstMove, SMove *move) {
struct stockage stock;
int i;
int start, end, next;
stock = storage(0, 0, 0);
printf("joueur %d, pions : [ ", stock.color);
for(i=0;i<121;i++) {
if(gameState->board[i] == stock.color)
printf("%d, ", i);
puts(" ]");
puts("== premier mouvement ==");
printf("mouvement (start, end, next) ?");
scanf("%d %d %d", &start, &end, &next);
move->startPos = start;
move->endPos = end;
printf("mouvement %d %d %d\n", move->startPos, move->endPos, next);
return next;