In this assignment you will write a guessing game in PHP that takes GET parameters and plays the game.
You can explore a sample solution for this problem at
http://www.wa4e.com/code/arrays/guess.php?guess=1234This sample solution won't completly pass the autograder. It needs some work to meet the specifications. You can download the code for the partially complete sample solution here. You will have to change this per the instructions in the autograder in order to pass the autograder.
There are several sources of information so you can do the assignment:
The autograder will randomly choose the "correct number" for your application so you will have to modify the sample code to adjust the correct answer. You also will need to add your name to the <title> tag in order for you to be given a grade for the assignment.
The autograder will run the following tests on your application:
This assignment will be graded by an online autograder that will actually connect to your site, request pages, and check the pages to verify correct implementation of the specifications. You will need to submit a URL that points to your application that can be accessed from the Internet.
If your application has a real URL (i.e. not "localhost") then you can submit that URL to the autograder. But if your application that is running on your laptop or desktop computer with a URL like http://localhost... you will need to install and use the ngrok application to get a temporary URL that can be submitted to the autograder this application.
Depending on where you put your guess.php relative to the DOCUMENT_ROOT of your PHP server, you will have a local URL to run your application similar to the following:
Download the ngrok ZIP file from the web site and extract it to your Desktop. Then open a terminal window or Windows command line:
Macintosh: cd Desktop ./ngrok http 8888 Windows cd Desktop ngrok http 80The last parameter to ngrok is the port where your Apache server is running.
Once ngrok is up and running, you should see a screen similar to this:
Concatenate the URL from ngrok with the URL suffix from your localhost URL and enter that URL in the browser as follows:
Nagivate to the autograder for the assignment in your LMS as directed by te instructor and submit the ngrok URL to the autograder:
If you want more detail, you can monitor the requests in an inspector by nagivating your browser to http://localhost:4040 while ngrok is running.
The following is a sample execution of the autograder on the sample application:
The best way to figure out why the autograder is unhappy with your application is to the toggle the most recently retrieved page directly aboce the Not found message and try to figure out why there is a mis-match. In the above example, since the sample implementation uses 42 as the correct answer and the autograder was expecting 46 to be the correct answer, when the autograder tried 45, the application indicated that the guess was too high which it was actually lower than 46.
You can run the autograder as many times as you like to work through the autograder complaints and fix the errors in your program.