Your challenge today is to take input like this:
And output the best possible move in a Bejeweled-like game that will match three or more letters, like this (note the capital
- The input will be
nlowercase letters each (where
ncould be any number).
- The output will be the best move you could make in a match-3 game, with the two letters you want to swap capitalized.
Matches should have the following priority (in these examples,
.indicates a square that doesn't matter):
X.. Yxx x.. x..
.X. xYx .x. .x.
You must find the match of the highest priority and output it.
- If there are multiple matches of the same priority, you can output any one of them.
- There will always be at least one match (your program can break if there are no matches, or do anything you want).
- I/O can be in any reasonable format (stdin/out, reading and writing files, function arguments/return values, dialog boxes, etc.) but NOT hardcoded (like
x="[insert input here]").
- This is code-golf so shortest code in bytes wins. If you use any network access for some reason, all bytes downloaded from the network count against your score.