30
Bunny Chai
Last seen 2 years ago
Member for 11 years, 5 months, 24 days
Difficulty Normal
##########
#|_) ._ ._ #
#|_)|_| || |\/ #
####### /##
how about
assert shot((0, 0), (1, 1), (3, 3), (2, 2)) == 0, "shot in butt of wall"
?
More
we use similar strategy, but mine is slightly more complicated,
i think this is quite stable, so far, yours and mine are the only non-random solutions that could pass 10000 random mazes...
More
for integer inputs, no floating point comparison and arithmetic...
More
because the matrix is special, so as the inverse, so no need to find inverse or do elimination explicitly...
More
overkill but nice formulation of transition matrix
at each step, either +1 or -1, so becomes 1-i/len or i/len, to not to be picked or to be picked
More
we got the same formula
but I don't bother to write down the proof...
More
Alternatively, solved using concepts of projective geometry in [here](http://www.checkio.org/mission/cakes-rows/publications/bunnychai/python-3/projective-geometry/).
More
u may use:
summary = [0] * 365
or just use Counter, in which the cnt is automatically set to 0 for u
More
def checkio(data):
list(map(add, data))
return total
just a little bit more simplified...
More