This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// m: proposed move | |
// blockers: blocking pieces | |
// pp: current piece position | |
function diagonalChecks(m, blockers, pp) { | |
let isGood = true; | |
for (const b of blockers) { | |
if (b.rank > pp.rank && b.file > pp.file) { | |
if (m.rank > pp.rank && m.file > pp.file) { | |
isGood = isGood && (m.rank < b.rank && m.file < b.file); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.add({ | |
role: "movement", | |
cmd: "legalSquares", | |
}, (msg, reply) => { | |
const isPawn = msg.piece.piece === 'P'; | |
const isKnight = msg.piece.piece === 'N'; | |
this.act({ | |
role: "movement", | |
cmd: "rawMoves", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function specialMovement(options) { | |
//... | |
this.add({ | |
role: "movement", | |
cmd: "rawMoves", | |
isPawn: true | |
}, (msg, reply) => { | |
if (msg.piece.piece !== 'P') { | |
return ("piece was not a pawn") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Ba1 = new ChessPiece('Ba1'); | |
seneca.act({ | |
role: "movement", | |
cmd: "rawMoves", | |
piece: Ba1 | |
}, (err, msg) => {...}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.add({ | |
role: "movement", | |
cmd: "rawMoves", | |
}, (msg, reply) => { | |
var err = null; | |
var rawMoves = []; | |
var pos = msg.piece.position; | |
switch (msg.piece.piece) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList | |
import java.util.List | |
interface IBowlingBall { | |
String getBrand(); | |
String getSerialNumber(); | |
} | |
abstract class BowlingBall implements IBowlingBall { | |
private String brand, serialNumber; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BowlingBallFactory { | |
static private class BowlingBall implements IBowlingBall{ | |
private String petName; | |
BowlingBall() { | |
} | |
private void setPetName(String petName) { | |
this.petName = petName; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IBowlingBall { | |
String getPetName(); | |
} | |
class Bowler { | |
static private class BowlingBall implements IBowlingBall{ | |
private String petName; | |
BowlingBall() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BowlingBall { | |
private String petName; | |
BowlingBall() { | |
} | |
void setPetName(String petName) { | |
this.petName = petName; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var menu = require('./menu'); | |
var Combinator = require('./Combinator-generator-naive'); | |
function run() { | |
var threeCombos = new Combinator({ | |
min: menu.threeItems.min, | |
max: menu.threeItems.max | |
}) | |
.combine([], menu.threeItems.values); |