interprogram communication

A

Ajinkya

I am doing a project for college event.
It is named AI WARS.
Basic idea is that contestants will be given a signature of a function
for input to their program.

There will be a game bet 2 contestants. Each has to write an algorithm
for his next move.
The game is Othello/Reversi .

So I have writen the game engine part and we have decided the program
signature to be provideed to the contestants.

My problem is how do I connect the 3 programs
1. The Game Engine
2. Contestant 1 Program
3. Contestant 2 Program

I want a way in which my game engine will give control to the
contestant's programs one at a time alternately for the next moves of
each player alternately.

Can anyone suggest me something to carry out the inter program
communication ?
 
J

Joachim Schmitz

Ajinkya said:
I am doing a project for college event.
It is named AI WARS.
Basic idea is that contestants will be given a signature of a function
for input to their program.

There will be a game bet 2 contestants. Each has to write an algorithm
for his next move.
The game is Othello/Reversi .

So I have writen the game engine part and we have decided the program
signature to be provideed to the contestants.

My problem is how do I connect the 3 programs
1. The Game Engine
2. Contestant 1 Program
3. Contestant 2 Program

I want a way in which my game engine will give control to the
contestant's programs one at a time alternately for the next moves of
each player alternately.

Can anyone suggest me something to carry out the inter program
communication ?
Have a look at
http://en.wikipedia.org/wiki/Inter-process_communication

Bye, Jojo
 
U

user923005

I am doing a project for college event.
It is named AI WARS.
Basic idea is that contestants will be given a signature of a function
for input to their program.

There will be a game bet 2 contestants. Each has to write an algorithm
for his next move.
The game is Othello/Reversi .

So I have writen the game engine part and we have decided the program
signature to be provideed to the contestants.

My problem is how do I connect the 3 programs
1. The Game Engine
2. Contestant 1 Program
3. Contestant 2 Program

I want a way in which my game engine will give control to the
contestant's programs one at a time alternately for the next moves of
each player alternately.

Can anyone suggest me something to carry out the inter program
communication ?

http://sourceforge.net/projects/netothello/
 
N

Nick Keighley

I am doing a project for college event.
It is named AI WARS.
Basic idea is that contestants will be given a signature of a function
for input to their program.

There will be a game bet 2 contestants. Each has to write an algorithm
for his next move.
The game is Othello/Reversi .

So I have writen the game engine part and we have decided the program
signature to be provideed to the contestants.

My problem is how do I connect the 3 programs
1. The Game Engine
2. Contestant 1 Program
3. Contestant 2 Program

I want a way in which my game engine will give control to the
contestant's programs one at a time alternately for the next moves of
each player alternately.

Can anyone suggest me something to carry out the inter program
communication ?
 
N

Nick Keighley

I am doing a project for college event.
It is named AI WARS.
Basic idea is that contestants will be given a signature of a function
for input to their program.

There will be a game bet 2 contestants. Each has to write an algorithm
for his next move.
The game is Othello/Reversi .

So I have writen the game engine part and we have decided the program
signature to be provideed to the contestants.

My problem is how do I connect the 3 programs
1. The Game Engine
2. Contestant 1 Program
3. Contestant 2 Program

I want a way in which my game engine will give control to the
contestant's programs one at a time alternately for the next moves of
each player alternately.

Can anyone suggest me something to carry out the inter program
communication ?

have you considered not making them standalone programs?
Just link the functions into a driver program.
No threads, no IPC. Everyone has to give their
function a unique name (eg. preceed the name with their
initials).


int main (void)
{
Board boad; /* some complex structure */

while (!finished (&board))
{
player1_move (&board);
player2_move (&board);
draw (&board);
}
}
 
A

Ajinkya

have you considered not making them standalone programs?
Just link the functions into a driver program.
No threads, no IPC. Everyone has to give their
function a unique name (eg. preceed the name with their
initials).

int main (void)
{
Board boad; /* some complex structure */

while (!finished (&board))
{
player1_move (&board);
player2_move (&board);
draw (&board);
}

}

I thought about this option too!
But we want to give a downloadable game engine for participants to
practice and we cannot give them the code of our engine there.
Is there any other option where I can give a downloadable .exe file
and then the user can link his program and the game engine ?

Thanks in advance,

Regards,
Ajinkya
 
N

Nick Keighley

don't quote sigs (the bit after "-- ")
I thought about this option too!
But we want to give a downloadable game engine for participants to
practice and we cannot give them the code of our engine there.
Is there any other option where I can give a downloadable .exe file
and then the user can link his program and the game engine ?

well this is outside the C standard. But you could give them
a linkable library containing your engine.

This then depends on the compiler and linker. But there may be
static libraries (.o or .a files). But this may mean your
players become very constrained on what the functions are called.

Then there are dynamic libaries (.so or .dll). But then you really
are in platform specific land.

Hmm. Pass in pointers to the functions maybe.

#include "engine.h"
#include "player1.h"
#include "player2.h"

int main (void)
{
run_engine (player1_move, player2_move);
}

yeah, it can be made to work, but you needd to read your compiler
documentation on linking libraries together.

I'd probably use a static library and link with the players
functions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top