12
0
The user will hide, and the computer will try to find them.
First, the program will take an input, for the size of the grid. Like 5x5, 10x10, 15x15, etc. The grid won't always be a perfect square.
The grid is sort of like a chessboard:
_______________________________
| | | | | |
| A1 | | | | | A
|_____|_____|_____|_____|_____|
| | | | | |
| | B2 | | | | B
|_____|_____|_____|_____|_____|
| | | | | |
| | | C3 | | | C
|_____|_____|_____|_____|_____|
| | | | | |
| | | | D4 | | D
|_____|_____|_____|_____|_____|
| | | | | |
| | | | | E5 | E
|_____|_____|_____|_____|_____|
1 2 3 4 5
Now, the user will pick a square, such as B2
(without telling the computer)
The computer will start guessing squares. If it picks the correct square, the user will respond with y
. If not, they will input the direction their tile is from the one picked (N, NE, E, SE, S, SW, W).
So if the user picked B2
, and the computer guessed C3
, the user would input NW
.
Here is an example of the outputs and inputs:
Grid?
5x5
C3?
NW
C2?
N
B2?
y
Scoring:
This will be scored a little differently than a normal challenge.
The winner is the program that takes lowest number of guesses (on average) it takes to guess the correct square. The test cases to be averaged will be all of the possible squares in a 5x5 and then in a 10x10.
However, it must also work with every pattern of grid up to 26 rows (i.e. 5x8, 6x2, 20x5, etc.).
Please include a way for it to be tested, such as a JSFiddle.
And lastly, in case of a tie, the shortest program wins.
1If I'm hiding on
A1
and the computer guessesB9
, is the proper responseNW
orW
? – Greg Martin – 2017-03-30T20:09:13.610@GregMartin It would be NW.... N, W, S, E must all be straight while anything on a different row/column must be NW, NE, SW, SE – JKonowitz – 2017-03-30T20:12:10.807
Is there flexibility in the specific format of input and output? If there are more than 26 rows, what are they called? – Greg Martin – 2017-03-30T20:14:18.650
@GregMartin You can be flexible with the output but try to keep it simple. It doesn't have to be exactly the same but should have a similar style. You do not need to account for anything above 26, I will edit that. – JKonowitz – 2017-03-30T20:17:22.707
I don't know what "similar style" means. Can we take input as an ordered pair of integers (row#, col#)? (PS: These types of questions are reasons why pre-posting challenges in the Sandbox is a great idea.)
– Greg Martin – 2017-03-30T20:18:39.953The AI must take in input, guess an output. It does not need to follow a format. I also did post this in the Sandbox but didn't get much feedback. – JKonowitz – 2017-03-30T20:20:12.810
Can we use neural network to guess the square at the first time? XD – Matthew Roh – 2017-03-30T23:05:15.780
@SIGSEGV Sure, I dont see why not. – JKonowitz – 2017-03-31T00:33:53.133