Stuart, neat but not complete. The initial tests say bottom left start goes up.
On the following test:
Set matrix($INCREMENT(matrix)) = "A,B,C"
Set matrix($INCREMENT(matrix)) = "H,I,D"
Set matrix($INCREMENT(matrix)) = "G,F,E"
d $$$AssertEquals(..Solution(.matrix, 1, 1), "ABCDEFGHI")
d $$$AssertEquals(..Solution(.matrix, 1, 2), "BCDEFGHI")
d $$$AssertEquals(..Solution(.matrix, 1, 3), "CDEFGHABI")
d $$$AssertEquals(..Solution(.matrix, 2, 3), "DEFGHABI")
d $$$AssertEquals(..Solution(.matrix, 3, 3), "EFGHABCDI")
d $$$AssertEquals(..Solution(.matrix, 3, 2), "FGHABCDI")
d $$$AssertEquals(..Solution(.matrix, 3, 1), "GHABCDEFI")
d $$$AssertEquals(..Solution(.matrix, 2, 1), "HABCDEFI")
Yours fails when starting on E,F,G,H.
I have tidied up mine and got rid of the mess of gotos at the top and assumes the matrix is not empty, current score 214.
Hi Stuart,
I did not publish my solution because I thought 231 sounded a bit embarrassing for this game. 227 sounds in the same league so I am happier now.
I also applied the "what would Stuart do?" theory to my shot, and what do you know: 227.
ClassMethod Solution(ByRef n, r, c) As %String
{
s (a,p)=$g(n),b=1,q=1,o="" g:c=1 4:r>1 g:c=a 3:r=p,2 g 3:r=p
1 s e=0 F c=c:1:a{d m} S q=$i(r)
2 F r=r:1:p{d m} S c=c-1,a=c
3 F c=c:-1:b{d m} S r=r-1,p=r
4 F r=r:-1:q{d m} S b=$i(c)
g:e 1 q o
m S o=o_$P(n(r),",",c),e=1
}
Open Exchange applications:
Certifications & Credly badges:
Paul has no Certifications & Credly badges yet.
Global Masters badges:
Paul has no Global Masters badges yet.
Followers:
Paul has no followers yet.
Following:
Paul has not followed anybody yet.
There is only one person who can answer what the expected result should be. I think Eduard made it clear by providing the tests that should pass.
TestStartMiddleRight - this is the same as the my test starting at D
TestStartBottomLeft - this is the same as my test starting at G
My other tests were based on simply rotating the matrix - I was not happy that my code was passing those two tests but could still be wrong, in my opinion, starting at the bottom middle of the grid.
My last go at this is 212.
I hope the next hole is not as controversial.