ive been told to create an html file containing a textbox to enter numbers 0 to 6. This is to be posted to a php file. The number represents a guess for the amount of times a particular sequence of letters - ABC, will be randomly created...
I also have a specific request to create this php file. Can people help me out! đ
Create a php file to generate a random 3 letter word with letters made up of A, B or C. Generate this 50 times and check if the random guess received from the html file is correct
1. receive the guess value and check that
- The value is between 0 & 6 and is a number â (by using the is_numeric( ) function)
2. then create 3 random numbers (each either 1, 2 or 3) using a for loop and rand function
- check the value of each number as they are created (using an if statement) to assign the
letter A for 1, B for 2, C for 3 to a letterstring variable
- add the letter to a wordstring variable each time (using string concatenation with .
[e.g. $wholename = $firstname . â â . $surname] - analagous to the way of
creating a running total of numbers within a for loop using $total = $total + $number; )
ending up with a wordstring variable made up of 3 letters in random order
- Now create 50 different word strings using a for loop around the code for b2.
- check the wordstring to see if âABCâ has been generated
[ since it is random there are 27 different combinations of 3 letters that
can be created: AAA, AAB, AAC,ABA, ABB, ABC, BAC,BBA,BBB,BBC,BCA,BCB,
ACA,ACB,ACC,BAA,BAB, BCC,CAA,CAB,CAC,CBA,CBB,CBC,CCA,CCB,CCC ]
- if âABCâ is created print âFound ABC stringâ & increment a count for ABC strings
- print the guess value and the number of times the âABCâ sequence occurs
- compare the guess with the actual number of times the âABCâ sequence occurs
- print either âYou have guessed correctlyâ or âIncorrect guess â try again!â
depending on whether the guess matches the ABC count or not
thanks for all your help!!!!