Talk:Knight's tour: Difference between revisions

(Incomplete Tours)
Line 27:
 
--[[User:Dgamey|Dgamey]] 13:21, 30 May 2011 (UTC)
 
:I did implement Roths extension, which is to break ties by chosing the point furthest from the centre:
:<lang python>def accessibility(board, P, boardsize=boardsize, roths_extension=True):
access = []
brd = copy.deepcopy(board)
for pos in knightmoves(board, P, boardsize=boardsize):
brd[pos] = -1
if not roths_extension:
access.append( ( len(knightmoves(brd, pos, boardsize=boardsize)),
pos ) )
else:
access.append( ((len(knightmoves(brd, pos, boardsize=boardsize)),
-(complex(*pos) - (boardsize/2. + boardsize/2.j)).__abs__()),
pos) )
brd[pos] = 0
return access</lang>
:I didn't really have time to measure its effectiveness though. --[[User:Paddy3118|Paddy3118]] 13:27, 30 May 2011 (UTC)
Anonymous user