Alrededor

def alrededor(numero_casilla): from posicion import posicion miposicion=posicion(numero_casilla) resultado=[(miposicion[0],miposicion[1]-1),(miposicion[0]-1,miposicion[1]),(miposicion[0],miposicion[1]+1),(miposicion[0]+1,miposicion[1])], return(resultado)
Alrededor stands for around. Casilla stands for square. This snippet returns four squares position for the four squares near the given one, in order : left, above, right and below.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.