
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
minimal bitboard classes for boardgames. Contains an all purpose class and two sub classes for Chess and Connect Four
npm install --save bitboards
<script src="https://unpkg.com/bitboards@1.0.6/bitboards.min.js"></script>
node.js
// Node
const { BitBoard, ChessBitBoard, ConnectFourBitBoard } = require('bitboards');
const board = new BitBoard();
modules
import { BitBoard, ChessBitBoard, ConnectFourBitBoard } from 'bitboards';
const board = new BitBoard();
unpkg
// index.html
<script src="https://unpkg.com/bitboards@1.0.6/bitboards.min.js"></script>
// file.js
const board = new BitBoard();
The last parameter to all binary operator methods is an [optional] boolean flag modify. When true the BitBoard calling the method will be modified as opposed to leaving the calling BitBoard unchanged and returning a new BitBoard. If a BitBoard is an argument to a method it is ALWAYS left unchanged.
Array Input
let boardA = new BitBoard();
let boardB = new BitBoard([Math.pow(2,32) - 1, Math.pow(2, 32) - 1]);
// boardA.board --> [0, 0]
// boardB.board --> [4294967295, 4294967295]
boardA.length // --> 64
boardB.length === boardA.length // --> true
String Input
let boardA = new BitBoard('11111111');
let boardB = new BitBoard('1111111111111111111111111111111100000000000000000000000000000000');
// boardA.board --> [0, 65535];
// boardB.board --> [4294967295, 0]
let boardC = new BitBoard('1010101a') // --> Error
let board = BitBoard([Math.pow(2,32) - 1, 0]);
board.toString();
// length = 64
// --> "1111111111111111111111111111111100000000000000000000000000000000"
let board = BitBoard([Math.pow(2,32) - 1, 0]);
board.getIndex(0) // --> 0
board.getIndex(63) // --> 1
board.getIndex(64) // --> RangeError
let board = BitBoard([Math.pow(2,32) - 1, 0]);
let copyBoard = board.copy();
board.board === copyBoard.board // --> false
let board = new BitBoard([Math.pow(2,32) - 1, 0]);
let defaultBoard = new BitBoard();
board.isEmpty() // --> false
defaultBoard.isEmpty() // --> true
let boardA = new BitBoard();
// --> "0000000000000000000000000000000000000000000000000000000000000000"
let boardB = new BitBoard([Math.pow(2,32) - 1, Math.pow(2,32) - 1]);
// --> "1111111111111111111111111111111111111111111111111111111111111111"
boardA.and(boardB)
// --> "0000000000000000000000000000000000000000000000000000000000000000"
let boardA = new BitBoard();
// --> "0000000000000000000000000000000000000000000000000000000000000000"
let boardB = new BitBoard([Math.pow(2,32) - 1, Math.pow(2,32) - 1]);
// --> "1111111111111111111111111111111111111111111111111111111111111111"
boardA.or(boardB)
// --> "1111111111111111111111111111111111111111111111111111111111111111"
let boardA = new BitBoard();
// --> "0000000000000000000000000000000000000000000000000000000000000000"
let boardB = new BitBoard([Math.pow(2,32) - 1, Math.pow(2,32) - 1]);
// --> "1111111111111111111111111111111111111111111111111111111111111111"
boardA.xOr(boardB)
// --> "1111111111111111111111111111111111111111111111111111111111111111"
let board = new BitBoard([Math.pow(2, 32) - 1, 0]);
// --> "1111111111111111111111111111111100000000000000000000000000000000"
board.orNumber(5, 10);
// --> "1111111111111111111111111111111100000000000000000000000101000000"
let board = new BitBoard([Math.pow(2, 32) - 1, Math.pow(2,32) - 1]);
// --> "1111111111111111111111111111111111111111111111111111111111111111"
board.xOrNumber(2, 10);
// --> "1111111111111111111111111111111111111111111111111111111111010111"
let board = new BitBoard([Math.pow(2, 32) - 1, Math.pow(2,32) - 1]);
// --> "1111111111111111111111111111111111111111111111111111111111111111"
board.not()
// --> "0000000000000000000000000000000000000000000000000000000000000000"
let board = new BitBoard([0, Math.pow(2, 32) - 1]);
// --> "0000000000000000000000000000000011111111111111111111111111111111"
board.shiftLeft(54)
// --> "1111111111000000000000000000000000000000000000000000000000000000"
let board = new BitBoard([Math.pow(2, 32) - 1, 0]);
// --> "1111111111111111111111111111111100000000000000000000000000000000"
board.shiftRight(54);
// --> "0000000000000000000000000000000000000000000000000000001111111111"
let board = new BitBoard([65535, 0]);
// --> "0000000000000000111111111111111100000000000000000000000000000000"
board.flipVertical()
// --> "0000000000000000000000000000000011111111111111110000000000000000"
let board = new BitBoard([65535, 0]);
// --> "0000000000000000111111111111111100000000000000000000000000000000"
board.flipDiagonal()
// --> "0000110000001100000011000000110000001100000011000000110000001100"
let board = new BitBoard([65535, 0]);
// --> "0000000000000000111111111111111100000000000000000000000000000000"
board.rotate180Degrees()
// --> "0000000000000000000000000000000011111111111111110000000000000000"
let board = new BitBoard([16711935,0]);
// --> "0000000011111111000000001111111100000000000000000000000000000000"
board.rotate90DegreesClockwise()
// --> "0000101000001010000010100000101000001010000010100000101000001010"
let whiteA1Orientation = new ChessBitBoard({ boardType: "white", lsb: "a1" });
let blackA8Orientation = new ChessBitBoard({ boardType: "black" });
// --> whiteA1Orientation.board = [0, 65535] = blackA8Orientation
boardType: string [optional]
board: Array [optional]
lsb: string [optional]
NOTE ON ARGUMENTS
SHAPE OF DEFAULT BOARDS
All default boards are based on the the starting positions for pieces according to the following mapping of squares to indicies. NOTE only "white" and "black" change if lsb is set to "a1".
| a | b | c | d | e | f | g | h |
|---|---|---|---|---|---|---|---|
| a8: 0 | b8: 1 | c8: 2 | d8: 3 | e8: 4 | f8: 5 | g8: 6 | h8: 7 |
| a7: 8 | b7: 9 | c7: 10 | d7: 11 | e7: 12 | f7: 13 | g7: 14 | h7: 15 |
| a6: 16 | b6: 17 | c6: 18 | d6: 19 | e6: 20 | f6: 21 | g6: 22 | h6: 23 |
| a5: 24 | b5: 25 | c5: 26 | d5: 27 | e5: 28 | f5: 29 | g5: 30 | h5: 31 |
| a4: 32 | b4: 33 | c4: 34 | d4: 35 | e4: 36 | f4: 37 | g4: 38 | h4: 39 |
| a3: 40 | b3: 41 | c3: 42 | d3: 43 | e3: 44 | f3: 45 | g3: 46 | h3: 47 |
| a2: 48 | b2: 49 | c2: 50 | d2: 51 | e2: 52 | f2: 53 | g2: 54 | h2: 55 |
| a1: 56 | b1: 57 | c1: 58 | d1: 59 | e1: 60 | f1: 61 | g1: 62 | h1: 63 |
BitBoard class with an isWin() static method.
Special thanks to denkspuren for isWin logic and the following diagram.
SHAPE OF CONNECT FOUR GAME
6 13 20 27 34 41 48 55 62 Additional row
+---------------------+
| 5 12 19 26 33 40 47 | 54 61 top row
| 4 11 18 25 32 39 46 | 53 60
| 3 10 17 24 31 38 45 | 52 59
| 2 9 16 23 30 37 44 | 51 58
| 1 8 15 22 29 36 43 | 50 57
| 0 7 14 21 28 35 42 | 49 56 63 bottom row
+---------------------+
const northWestToSouthEastWinBoard = new ConnectFourBitBoard([0, 2130440]);
// --> "0000000000000000000000000000000000000000001000001000001000001000"
// --> 1s at [3, 9, 15, 21]
ConnectFourBitBoard.isWin(northWestToSouthEastWinBoard);
// --> true
FAQs
minimal bitboard classes for boardgames. Contains an all purpose class and two sub classes for Chess and Connect Four
We found that bitboards demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.