IN GO LANGUAGE, NOTHING ELSE PLEASE   Here are the requirements: 1)     You need to write guess_num.go so it supports the “guess a number between X and Y” kind of game, but allows the user to either choose the numbers themselves or allow the computer to automatically generate the guesses. The point of this assignment is to work with interfaces, so you will have some specific requirements on how you solve the problem.   2)     Let’s start with the sample output:     a)     First, the case where the user enters their own numbers: (user input in bold and red)     Guess a number to demo interfaces      You have 3 guesses to guess a number from 1 to 10    Do you want to make the guesses? (y/n -- if n guesses will be generated for you): y     Enter your next guess: 5    Too low     Enter your next guess: 8     You win!     b)     Now the case where the user lets the computer pick the numbers:     Guess a number to demo interfaces      You have 3 guesses to guess a number from 1 to 10     Do you want to make the guesses? (y/n -- if n guesses will be generated for you): n    The computer has chosen 5     Too low     The computer has chosen 8      Too high      The computer has chosen 6     You ran out of guesses. Game over     3)     Your file will include one interface, IPlayer:     a)     It has just one function prototype, guess(), which takes no parameters and returns an integer     4)     Your file will include three struct’s:     a)     Game which includes          i)      An IPlayer for the player making the guesses            ii)    Integers for the number of guesses made so far, the (random) number the user is trying to match, and the            most recent guess     b)     Autoguess for an object that generates guesses. It includes             i)      Integers for the min and max possible values             ii)    A pointer to the Game     c)     Human which is defined as an empty struct     5)     You need to write the following methods:     a) func (g *Game) play()           i) This plays the game by calling the player’s guess() to get the next guess and outputting the appropriate                  response     b) func (h *Human) guess() (num int)asks the user for the next number to guess (why the 5 and 8 above are in red)     c)     func (a *Autoguess) guess() (num int) will return an appropriate guess based on choosing the middle value          of  the possible remaining values     6)     You only need to submit guess_num.go.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

IN GO LANGUAGE, NOTHING ELSE PLEASE

 

Here are the requirements:

1)     You need to write guess_num.go so it supports the “guess a number between X and Y” kind of game, but allows the user to either choose the numbers themselves or allow the computer to automatically generate the guesses. The point of this assignment is to work with interfaces, so you will have some specific requirements on how you solve the problem.

 

2)     Let’s start with the sample output:

    a)     First, the case where the user enters their own numbers: (user input in bold and red)

    Guess a number to demo interfaces

 

   You have 3 guesses to guess a number from 1 to 10

   Do you want to make the guesses? (y/n -- if n guesses will be generated for you): y

    Enter your next guess: 5

   Too low

    Enter your next guess: 8

    You win!

    b)     Now the case where the user lets the computer pick the numbers:

    Guess a number to demo interfaces

 

   You have 3 guesses to guess a number from 1 to 10

    Do you want to make the guesses? (y/n -- if n guesses will be generated for you): n

   The computer has chosen 5

    Too low

    The computer has chosen 8

     Too high

     The computer has chosen 6

    You ran out of guesses. Game over

 

 

3)     Your file will include one interface, IPlayer:

    a)     It has just one function prototype, guess(), which takes no parameters and returns an integer

 

 

4)     Your file will include three struct’s:

    a)     Game which includes

         i)      An IPlayer for the player making the guesses

           ii)    Integers for the number of guesses made so far, the (random) number the user is trying to match, and the            most recent guess

    b)     Autoguess for an object that generates guesses. It includes

            i)      Integers for the min and max possible values

            ii)    A pointer to the Game

    c)     Human which is defined as an empty struct

 

 

5)     You need to write the following methods:

    a) func (g *Game) play()

          i) This plays the game by calling the player’s guess() to get the next guess and outputting the appropriate                  response

    b) func (h *Human) guess() (num int)asks the user for the next number to guess (why the 5 and 8 above are in red)

    c)     func (a *Autoguess) guess() (num int) will return an appropriate guess based on choosing the middle value          of  the possible remaining values

 

 

6)     You only need to submit guess_num.go.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY