I am trying to write a script for a puzzle based on the user's IP address, but I just can't wrap my head around how to do it. Essentially, when the visitor loads the page two things happen:
(1) a PHP application returns an image to serve as a background for the formula,
(2) implement the algorithm of generating the formula based on IP, that is displayed on the image.
The puzzle itself would be in the form of ABC.DEF.GHI.JKL where each letter would be associated with the corresponding digit in their IP addy. The user is trying to solve for partial map coordinates. So, let's say the correct answer is N 35 54.374 W 084 01.829 and the user's IP is 075.036.025.058. The formula returned and placed on the image would be N 35 54. (E) (B) (F - H) W 084 01. (L) (H) (B + H)
The algorithm basically needs to get the set of available digits from the IP and check if it can build the formula digits from those. If not, there would be a fallback for a missing number; for example given the above answer and if the available digits couldn't make a 9 then it would be represented by something like (C + 4).
Whatever I use as the final correct answer will not change and be the same for all users; only the puzzle formula would differ for each user as it would be based on their IP at the moment.
Any help here would be greatly appreciated. Thanks!
Gary