Sep 27th, 2006, 4:54 AM
|
#5
|
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 154
Rep Power: 3 
|
Quote:
Originally Posted by programmingnoob
In this assignment, you are required to use LINUX inter-process communication (IPC) to
implement the game of “Rock, Paper, and Scissors”. The rule of this game need not be further
explained (just see the picture below). In each round, if two players choose the same weapon, the
round is a still a tie and the tie must be broken.
You are asked to write a player program. When a player enters the system, it should check if
another player is already waiting there. If so, the new player will challenge the existing player.
They will play a best-of-five series to decide the winner. A player may also forfeit the series.
Then the loser leaves and the winner will wait for another challenger. If multiple players want to
challenge an existing player, they will join on a first-come first-serve basis.
To implement this, you need to use the message-passing interface in LINUX. The first player
should create a message queue (with a well-known key). A new arriving player should get the
queue identifier to communicate with the existing player. You need to make sure only two players
are playing the game at one time. The choices of weapon should be exchanged between two
players in a best-of-five series. The text terminals should display the progress of the series. In
addition, the message queue should be destroyed when the last player in the system leaves.
before you get mad at me for posting an assignment here, let me tell you that it makes me feel comfortable if i discuss my approach with someone as I proceed. I dont know anybody in the class, so I am going to discuss my assignment here
^^^ now i am gonna divide the assignment into several sections.
the section i am gonna work first on is to manage the entrance of several players. I am going to assume that all the players enter from the same terminal. Now, there should be some way of knowin that a player is trying to enter the game, which can be used by assigning letter 'p' to determine that. In other words, any time 'p' in the keyboard gets hit, then it means somebody is trying to enter the game.
now am i supposed to use client server approach to handle this? if yes, then do different players imply different clients?
|
what do they mean by "To implement this, you need to use the message-passing interface in LINUX."?
Did they mean I need to use the stantard library header instead of manually coding the header?
|
|
|