projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug in Eightpieces rules (division by 0)
[vchess.git]
/
client
/
src
/
variants
/
Eightpieces.js
diff --git
a/client/src/variants/Eightpieces.js
b/client/src/variants/Eightpieces.js
index
beaddbe
..
f7d93d8
100644
(file)
--- a/
client/src/variants/Eightpieces.js
+++ b/
client/src/variants/Eightpieces.js
@@
-924,7
+924,7
@@
export const VariantRules = class EightpiecesRules extends ChessRules {
absDeltaX = Math.abs(deltaX);
const deltaY = y2 - y1,
absDeltaY = Math.abs(deltaY);
absDeltaX = Math.abs(deltaX);
const deltaY = y2 - y1,
absDeltaY = Math.abs(deltaY);
- const step = [ deltaX / absDeltaX
, deltaY / absDeltaY
];
+ const step = [ deltaX / absDeltaX
|| 0, deltaY / absDeltaY || 0
];
if (
// Check that the step is a priori valid:
(absDeltaX != absDeltaY && deltaX != 0 && deltaY != 0) ||
if (
// Check that the step is a priori valid:
(absDeltaX != absDeltaY && deltaX != 0 && deltaY != 0) ||