Phase 1

What you must do :

  • find in a grid of 5 x 5 of letters, if there is a word from the list of given words present in that grid.
  • the words can be in column or in a row, not in diagonal or in reverse
  • the words are case sensitive and all are composed of 3 letters
  • there is only one word per grid to be found
  • there are 3 games to complete
  • your implementation must be optimized, to do the least access to the system to check which letter are in each position
  • the list of word is stored externally, and accessible thru a URL. You must re-access the list at each execution of your program. The list of words is the same for all the games.
  • there is a URL to access for each game, what letter is located at a specific position.

When you locate a word from the list, you must output its beginning position and its ending position < column>< row>:< column>< row>.

As an example, if you search for jar in this array:

A B j a r
A z D e F
z f D q W
P T w V Q
Z O q H I

The word jar is located at : C1:E1

The output should be : game< 1-3> word:< word found>

location:< beginning-end>

Your program must download the list of words at each execution, as it may change over time.

The list of words to search for is accessible thru:https:// wordfinder-001.appspot.com/word.txt (List of words extracted from: http://wordfinder.yourdictionary.com/letter-words/3)

To access a letter at a specific location: https:// wordfinder-001.appspot.com/wordfinder? game=< 1to3>&pos=< column>< row>

Column: a-e
Row: 1-5

As an example : https://wordfinder-001.appspot.com/wordfinder? game=1&pos=b5 will return the letter E, which is the letter in the 2nd column, the 5th row.

The main class must be named: project1.java and be in the package csc312.

The system you are accessing to extract the letter, may produce status code SC_INTERNAL_SERVER_ERROR=500 or SC_FORBIDDEN=403 at random interval, if this happen, you must retry accessing the resource up to 5 times.

To test your error handling for SC_INTERNAL_SERVER_ERROR and SC_FORBIDDEN, there are specific pos that will generate it all the time:

If you use pos=Z99, the status code will be SC_INTERNAL_SERVER_ERROR.

If you use pos=Z88, the status code will be SC_FORBIDDEN. Submission: one submission per team. Upload a zipped file or your project directory.

Phase 2

A word finder server, similar to what you had to interact with for Project #1, but this time, you will be handling the request with additional functionality.

1-Starting a contest: an user must start a contest, before requesting a letter, with a url such as : http://localhost:8080/newcontest. The response to newcontest, will return a random number ranging between 1-1000, that will be used for subsequent request as contestid. You must make sure, you do not used a contest id which is currently in used.

For each subsequent request to the server, the contestid must be specified on the url.

For each contest, a 120 seconds timer countdown must be started. When 0 is reached, subsequent request will be returned the status code HttpServletResponse.SC_GONE.

2-Accessing a letter: to access a letter at a specific location: http:// localhost:8080//wordfinder?contest=< contest id received as response to newcontest>&game=< 1 to 3>&pos=< column>< row>

contest:the contest id receives in newcontest.
game:1-3
Column: a-e
Row: 1-5

If the user submits a request, with an invalid contest id, game or pos, you must responded with the status code: response.SC_BAD_REQUEST.

3-Submitting a solution: to submit a solution for a game, you must do it in the contact of a contest, a specific url is used: http://localhost:8080// solution?contest=< contest id received as response to newcontest>&game=< 1 to 3>&solution=< word>

contest:the contest id receives in newcontest.
game:1-3
solution: the word which is the solution

If a submission is valid, SC_OK is returned and in the html text, the number of seconds it took to resolve the game and also, how many letters were requested.

If a submission is invalid for a game, the contest id must be considered invalid, and further request using this contest id should return response.SC_BAD_REQUEST.

For a valid submission, you must keep the top score (see #4). The solutions must be:

Game 1: position A1:A3, solution: zap
Game 2: position E3:E5, solution: zig
Game 3: position C2:C4, solution: zag

4-Top Score: the url : https:// localhost:8080/topscore, will return in descending order the list of the 5 fastest time to resolve any game.

Output:

contest id, time in seconds

5-Word list: the url https:// localhost:8080/words, will return this list of words:

zap
zep
zip
zag
zig

6-Unit tests:

you must provide individual unit tests for each items that you must test:

  • validation that the word list is correct
  • validation of starting a new contest
  • validation of requesting for a letter (valid and invalid values for each parameter and combination).
  • validation of the timeout process for a contest (see https:// docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html)
  • validation of submitting a solution (valid and invalid submission + management of the contest)
  • validation of the top score
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.