Add convenience 'Square' constructor in GDB utils
This commit is contained in:
parent
83a29cae2a
commit
a1005c1bec
|
@ -14,6 +14,10 @@ class Square(object):
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self._val = val
|
self._val = val
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_file_rank(cls, file, rank):
|
||||||
|
return cls(file * 8 + rank)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.FILES[self.file] + self.RANKS[self.rank]
|
return self.FILES[self.file] + self.RANKS[self.rank]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue