Jump to content

Need help with MasterMind in C


Shadowlord

Recommended Posts

Here's my code:

void playGame(char*);

void adjudicateGuess (char*, char*, int);

void mastermind (char*);

char* GenerateCode();

void playOneTurn (char*);

char* calcBlack (char*);

char* calcWhite (char*);

int WinOrLose (int, int);

void print_feedback();

void mastermind (char* Gen_code) {

    //generate code --> char *

    char* Secret_code;

}

char* GenerateCode () {

    char* Gen_code;

    //generates code

    //outputs random code

}

void playOneTurn (char* Secret_code) {

    //User input (guess code)

    char* Guess_code;

    //scanf("%d",Guess_code);

    printf("one turn");

}

void playGame (char* Secret_code) {

    //loop; playOneTurn * 10

    int i;

    int turnValue = 10;

    for (i=0;i<turnValue;i=i+1) {

        playOneTurn(Secret_code);

    }

}

void adjudicateGuess (char* Guess_code,char* Secret_code, int WinOrLose) {

    //check positions, winorlose/print white pegs, print black pegs

}

char* calcBlack (char* Secret_code) {

    int blackpegs;

}

char* calcWhite (char* Secret_code) {

    int whitepegs;

}

int WinOrLose (int whitepegs,int blackpegs) {

    //does player win or lose?

}

void print_feedback () {

   

}

int main () {

    char c;

    playGame ();

   

    c = getchar ();

}

------------------------------------------------------------------------------------------------------

The error says:

H:Documents2008SDDCodeCMasterMindmastermind. c In function `main':

64 H:Documents2008SDDCodeCMasterMindmastermind. c too few arguments to function `playGame'

----------------------------------------------------------------------------------------------------------

I can't seem to work out what's wrong.

Any assistance is greatly appreciated.  :)

Link to comment
Share on other sites

I don't do much C any more, but as it is similar to C#, i can help a bit.

You define play game as:

void playGame(char*);

but when you call it, you don't give the function argument:

playGame ();

So all you need is to have a char* variable as an argument, and it should work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...