interprogram communication

Discussion in 'C Programming' started by Ajinkya, Aug 28, 2007.

  1. Ajinkya

    Ajinkya Guest

    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 ?
    Ajinkya, Aug 28, 2007
    #1
    1. Advertising

  2. "Ajinkya" <> schrieb im Newsbeitrag
    news:...
    >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
    Joachim Schmitz, Aug 28, 2007
    #2
    1. Advertising

  3. Ajinkya

    user923005 Guest

    On Aug 28, 8:59 am, Ajinkya <> wrote:
    > 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/
    user923005, Aug 29, 2007
    #3
  4. Chris Thomasson, Aug 29, 2007
    #4
  5. On 28 Aug, 16:59, Ajinkya <> wrote:
    > 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 ?
    Nick Keighley, Aug 29, 2007
    #5
  6. On 28 Aug, 16:59, Ajinkya <> wrote:
    > 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);
    }
    }



    --
    Nick Keighley
    Nick Keighley, Aug 29, 2007
    #6
  7. Ajinkya

    Ajinkya Guest

    On Aug 29, 2:11 am, Nick Keighley <>
    wrote:
    > On 28 Aug, 16:59, Ajinkya <> wrote:
    >
    >
    >
    >
    >
    > > 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);
    > }
    >
    > }
    >
    > --
    > Nick Keighley- Hide quoted text -
    >
    > - Show quoted text -


    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
    Ajinkya, Aug 29, 2007
    #7
  8. On 29 Aug, 14:32, Ajinkya <> wrote:
    > On Aug 29, 2:11 am, Nick Keighley <>
    > wrote:
    > > On 28 Aug, 16:59, Ajinkya <> wrote:


    > > > 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);
    > > }

    >
    > > }


    don't quote sigs (the bit after "-- ")

    > > --
    > > Nick Keighley

    >
    > 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.


    --
    Nick Keighley
    Nick Keighley, Aug 29, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sherif ElMetainy
    Replies:
    7
    Views:
    476
    Alvin Bruney
    Nov 6, 2003
  2. john
    Replies:
    10
    Views:
    835
    Alan Fitch
    Nov 30, 2004
  3. Swapnajit Mittra
    Replies:
    0
    Views:
    435
    Swapnajit Mittra
    Dec 21, 2004
  4. Skybuck Flying

    Main memory <-> Cpu communication ?

    Skybuck Flying, Aug 2, 2005, in forum: VHDL
    Replies:
    2
    Views:
    1,008
    Jonathan Kirwan
    Aug 2, 2005
  5. Skybuck Flying
    Replies:
    10
    Views:
    872
    Derek Gladding
    Aug 19, 2005
Loading...

Share This Page