Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9224073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:13:35+00:00 2026-06-18T04:13:35+00:00

I am working through Stanford CS106B C++ assignments and I have a ‘semantic issue’

  • 0

I am working through Stanford CS106B C++ assignments and I have a ‘semantic issue’ with an assignment.

It seems as if the compiler cannot deduce whether the call is to a function or to the prototype of the function. I don’t understand why a call would ever be made to the prototype. How can I make it so that the call is made to the function rather than the prototype? The error message I get it “Call to ‘humansTurn’ is ambiguous”.

The error messages relate to the calls of the humansTurn(Lexicon,Lexicon) function, within the humansTurn(Lexicon,Lexicon) function, at the bottom of the page. The prototype for this function is above the main function.

Any help would be greatly appreciated.

Kind regards,

Mehul

    /*
     * File: Boggle.cpp
     * ----------------
     */

    #include <iostream>
    #include "gboggle.h"
    #include "graphics.h"
    #include "grid.h"
    #include "vector.h"
    #include "lexicon.h"
    #include "random.h"
    #include "simpio.h"
    using namespace std;

    /* Constants */

    const int BOGGLE_WINDOW_WIDTH = 650;
    const int BOGGLE_WINDOW_HEIGHT = 350;

    const string STANDARD_CUBES[16]  = {
       "AAEEGN", "ABBJOO", "ACHOPS", "AFFKPS",
       "AOOTTW", "CIMOTU", "DEILRX", "DELRVY",
       "DISTTY", "EEGHNW", "EEINSU", "EHRTVW",
       "EIOSST", "ELRTTY", "HIMNQU", "HLNNRZ"
    };

    const string BIG_BOGGLE_CUBES[25]  = {
       "AAAFRS", "AAEEEE", "AAFIRS", "ADENNN", "AEEEEM",
       "AEEGMU", "AEGMNN", "AFIRSY", "BJKQXZ", "CCNSTW",
       "CEIILT", "CEILPT", "CEIPST", "DDLNOR", "DDHNOT",
       "DHHLOR", "DHLNOR", "EIIITT", "EMOTTT", "ENSSSU",
       "FIPRSY", "GORRVW", "HIPRRY", "NOOTUW", "OOOTTU"
    };

    /* Function prototypes */

    void welcome();
    void giveInstructions();
    // Create random board
    static Grid <char> randomBoard();
    // Create custom board
    static Grid<char> customBoard();
    static void drawAndFillBoard(Grid<char>);
    static void humansTurn(Lexicon,Lexicon);

    int main() {
        initGraphics(BOGGLE_WINDOW_WIDTH, BOGGLE_WINDOW_HEIGHT);
        welcome();
        giveInstructions();
        string custom = getLine("Type y to create custom board:" );
        Grid<char> gridData;
        if (custom=="y"){
            gridData = customBoard();
        } else {
            gridData = randomBoard();
            }
        drawAndFillBoard(gridData);
        Lexicon english("EnglishWords.dat");
        // Lexicon holds words previously encountered
        Lexicon previousWords;
        humansTurn(english, previousWords);
        return 0;
    }

    /*
     * Function: welcome
     * Usage: welcome();
     * -----------------
     * Print out a cheery welcome message.
     */

    void welcome() {
       cout << "Welcome!  You're about to play an intense game " << endl;
    }

    /*
     * Function: giveInstructions
     * Usage: giveInstructions();
     * --------------------------
     * Print out the instructions for the user.
     */

    void giveInstructions() {
       cout << endl;
       cout << "The boggle board is a grid onto which I ";
       cout << "or triple your paltry score." << endl << endl;
       cout << "Hit return when you're ready...";
       getLine();
    }

    static Grid<char> randomBoard(){
        Vector<string> standardCubes;
        for(int i = 0; i<16;i++){
            standardCubes.add(STANDARD_CUBES[i]);
        }
        // Shuffle cubes
        for (int i = 0; i < standardCubes.size(); i++) {
            int r = randomInteger(i, standardCubes.size()-1);
            if (i!=r){
                string stringToMove1 = standardCubes.get(i);
                string stringToMove2 = standardCubes.get(r);
                standardCubes.set(r, stringToMove1);
                standardCubes.set(i, stringToMove2);
            }
        }
        // Update grid with random side of cube
        Grid<char> gridData(4, 4);
        int counter = 0;
        for (int columnNo = 0; columnNo <4; columnNo++){
            for (int rowNo = 0; rowNo<4; rowNo++) {
                string s = standardCubes.get(counter);
                int r = randomInteger(0, 5);
                gridData[columnNo][rowNo] = s[r];
                counter++;
            }
        }
        return gridData;
    }

    static Grid<char> customBoard(){
        Grid<char> gridData(4,4);
        string s = getLine("Please enter 16 characters to make up the custom board. Characters will fill the board left to right, top to bottom: ");
        for (int i = 0; i < s.length(); i++) {
            s[i] = toupper(s[i]);
        }
        if (s.length()<16){
            cout << "String has to be 16 characters long, try again" << endl;
            customBoard();
        }
        int i =0;
        for (int columnNo = 0; columnNo <4; columnNo++){
            for (int rowNo = 0; rowNo<4; rowNo++) {
                gridData[columnNo][rowNo] = s[i];
                i++;
            }
        }

        return gridData;
    }

    static void drawAndFillBoard(Grid<char> gridData){
        drawBoard(4, 4);
        for (int columnNo = 0; columnNo <4; columnNo++){
            for (int rowNo = 0; rowNo<4; rowNo++) {
                labelCube(rowNo, columnNo, gridData[rowNo][columnNo]);
            }
        }
    }

    static void humansTurn(Lexicon englishWords, Lexicon &previousWords){
        /*
         Human’s turn (except for finding words on the board). Write the loop that allows the user to enter words. Reject words that have already been entered or that don’t meet the minimum word length or that aren’t in the lexicon. Use the gboggle functions to add words to the graphical display and keep score.
         */

        string humanGuess = getLine("Please enter your guess: ");
        for (int i = 0; i < humanGuess.length(); i++) {
            humanGuess[i] = tolower(humanGuess[i]);
        }
        if (humanGuess.length()<4){
            cout << "Min guess length is four characters" << endl;
            humansTurn(englishWords, previousWords);
        }
        if (!englishWords.contains(humanGuess)) {
            cout << "That word is not English, please try another word" << endl;
            humansTurn(englishWords, previousWords);
        }
        if (previousWords.contains(humanGuess)){
            cout << "That word has already been guessed, please try another word" << endl;
            humansTurn(englishWords, previousWords);
        }
        // check if word can be made using data on board

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:13:37+00:00Added an answer on June 18, 2026 at 4:13 am

    Your function humansTurn definition has different signature with declaration

    function declaration:

    static void humansTurn(Lexicon,Lexicon);
    

    Function definition:

    static void humansTurn(Lexicon englishWords, Lexicon &previousWords) 
                                                         ^^
                                                         //Here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working through the CS106B course from Stanford, and while completing the
I'm working through the Stanford iPhone podcasts and have some basic questions. The first:
Hi I'm working through the Stanford iOS development class. I have a question regarding
I'm working through the CS193p Stanford iOS course and am nearly done with Assignment
I'm working through the Stanford iPhone programming course online. The Presence app assignment pulls
I've been working through the Stanford iPhone Coding course and currently hooking into the
I am working my way through the Stanford Fall 2011 iOS course: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/ I
I'm working through an R tutorial and suspect that I have to use one
I am working through the CS 193P course from 2011 from Stanford University and
I've been watching the Stanford CS193P lectures and I've been working on the assignment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.