3
\$\begingroup\$

I'm making a puzzle involving a 2D ASCII input and some moves. So in the spirit of this rotating maze:

https://stackoverflow.com/questions/3034331/code-golf-rotating-maze

But in thinking about solving puzzles like that, I find "looking for the ball" to be kind of annoying to tackle on every problem of that form. Especially a tougher one. I kind of wish the coordinates were in the input. Yet having the input show the ball and the holes in the maze as characters is much clearer visually in understanding the puzzle. Compare:

###########
#o        #
# ####### #
###@      #
  #########

To:

1 1
###########
#         #
# ####### #
###@      #
  #########

From people who've solved such things--is it more or less fun if the ball location is given as a coordinate out of band from the maze, or if you have to look for it? Further on the spectrum: imagine also if there were several holes, and those being in a list at the end, or somehow entered with a delimiter of some kind.

Is it part of the fun of something like this to have to "pre-process" the input yourself so the map looks good in the sample input?

\$\endgroup\$
1
\$\begingroup\$

I think it's good to have a mixture of styles.

Problems for which this question arises will tend to be simple graph problems at their core, so a typical solution will go through stages:

  1. Parse the input
  2. Build the graph
  3. Solve the graph problem
  4. Format the output

The last step is nearly always trivial. The actual graph problem is usually trivial: unless there are tight performance requirements, brute force is probably good enough. So it's not uncommon for the most interesting part to be parsing and building the graph.

If there's an existing question with the same underlying graph problem, you should either ditch your idea or acknowledge that the parsing and graph-building is the interesting part and try to design the question such that it will be the major part of the answer.

If it's a novel graph problem then you have more flexibility. Not everyone has the same tastes, so feel free to follow your own taste, to deliberately take the opposite choice to the most recent popular similar question, or to decide based on factors like the length of the test cases. If you think it would help people visualise or analyse the problem then you could include a simple program to convert between list-of-integer format and 2D format, which should be a couple of lines in a high-level language.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .