Cows and Bulls

The project involves a game between a server and two clients(users) . Consider the two clients say Player1 and Player2 .
The server selects a random four lettered word with no repetition of the letters .
The objective of the game is that the two clients are supposed to guess the randomly selected word correctly within a given number of chances . Each player is given half the letters (in this case its two letters ) to guess .

Say , the server chooses S H I P as its four lettered word.

player1 guesses T H
player2 guesses I S

player1 doesn't know player 2's guess and player1 doesn't know player 1's guess.

Together it forms T H I S (a valid dictionary word) . Then the server compares S H I P and the concatenated guesses of player 1 and player2 .
If there is 1 common alphabet , in the correct position , the server returns 1 Bull
If there is 1 common alphabet , in the wrong position , the server returns 1 Cow
If there are no common alphabets then it returns 0

So , for the above example , the server returns 2 Bull and 1 Cow( H and I are in the correct position and S is in the wrong position ) .

The given number or chances to guess the word is 15
The word should be a dictionary word without repetition of letters .

In order for player1 to get player2's guess ,provide authentication between the players , asking them to verify if they are sending the message to the right person .

Tags :
Your rating: None

Posted by

Tue, 03/04/2012 - 12:42

Also Posted