We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e0befd commit c87f6d4Copy full SHA for c87f6d4
1 file changed
queen_attack.py
@@ -0,0 +1,20 @@
1
+class Queen(object):
2
+ def __init__(self, row, column):
3
+
4
+ if -1<row<8 and -1<column<8:
5
+ self.row = row
6
+ self.column = column
7
+ else:
8
+ raise ValueError('ValueError')
9
10
+ def can_attack(self, another_queen):
11
12
+ if self.row==another_queen.row and self.column==another_queen.column:
13
14
15
+ if self.row==another_queen.row or self.column==another_queen.column:
16
+ return True
17
+ elif (abs(self.row-another_queen.row))==(abs(self.column-another_queen.column)):
18
19
20
+ return False
0 commit comments