Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In these first few weeks you have learned enough PHP to be able to create a simple web-based game, so let make is fun! This

In these first few weeks you have learned enough PHP to be able to create a simple web-based game, so let make is fun! This week you challenge is to recreate the pop-culture game "Rock, Paper, Scissors, Lizard, Spock" or RPSLS for short. The rules are simple, and the video that made the game famous explains it well. The expectations and grade rubric is quite simple: Two players have five choices to pick from, resulting in 25 unique combinations that must be evaluated. To achieve a perfect score, all rules (the 25 permutations) must be implemented and your code must calculate the correct result with 100% success rate. For every combination that does not work, you lose points. Only the implementation of rules will be graded, no other aspect. You may use any method you wish implement the new rules, but the use of functions and arrays are encouraged as they will simplify your code. The output of your program must include the item picked by both players as well as the calculated winner. Both players hand's must be chosen randomly by the program. Warnings and errors generated by your program will not be counted against your score, provided that that game still functions correctly. Coding Hints: If you are using the array approach, consider using nested arrays and the in_array function. The array_search function my also be handy, but may be more complicated than you need. If you do use array_search, pay close attention to the pink warning on php.net site. If you are not using the array approach, consider using a switch statement instead of a series if elseif's. Don't forget to change the way the players choices are randomized, remember that you have 5 possible. Remember the rules to "truthy-ness". The following values will evaluate to a false unless you use a === or !== operator to compare them. "" - an empty string 0 - 0 as an integer "0" - 0 as a string NULL FALSE array() - an empty array undeclared variables Sometimes multidimensional (nested) arrays can be scary. Often using dynamic variable names can reduce the need to use a nested array. Execute the code below for an example.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago