How can I add multiple implementations to this header file:
MoveAgent.h
#ifndef _GAMEAGENT_
#define _GAMEAGENT_
#include "Defs.h"
#include "GameModel.h"
MoveDirection takeDirection(GameState *gs);
#endif _GAMEAGENT_
MoveAgent.c: Let's say that I have an implementation that will return a random move
MoveDirection takeDirection(GameState *gs) {
MoveDirection dir = DIR_NONE;
while (dir == DIR_NONE) {
int index = arc4random() % gs->moves_total;
MoveDirection tempDir = gs->moves[index];
if (tempDir != oppDir(gs->car.direction)) {
dir = tempDir;
}
}
return dir;
}
What is practical way of having multiple implementations of that function?
As you might guess, I'm a Java programmer trying to make a basic game to learn C, so I'm trying to do this to simulate a Java interface.
Any ideas?