Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@chesslib/ai
Advanced tools
The AI is a simple implementation of a basic board evaluation. The AI is trying every moves possible confirming the board value is better for a given move. The search depth can be configured, and due to it's high CPU intensivity it is recommended to use it with webworkers in browsers, and run it as a seperate process or thread in nodejs if required.
npm install @chesslib/ai
https://www.npmjs.com/package/@chesslib/ai
Required dependency: https://www.npmjs.com/package/@chesslib/core
import { ChessAI } from "@chesslib/ai";
import { Chessboard, COLORS, Positions } from "@chesslib/core";
var chessboard = Chessboard.fromPosition(Positions.default);
// Create AI that find the best moves for BLACK for the chessboard with 2 players
var ai = new ChessAI(chessboard, COLORS.BLACK, 2);
// Returns the 5 best moves with search depth 3
var moves = ai.getBestMoves(3, 5);
ai.doMoveFEN({
from: "a2",
to: "a4"
});
For more please see examples folder
Simply include worker.js
in your application.
import { Chessboard, COLORS, Positions } from "@chesslib/ai";
import { ChessAIWorker } from "@chesslib/ai";
var chessboard = Chessboard.fromPosition(Positions.default);
let AIWorker = new ChessAIWorker("./worker.js");
// Gets the 210 best moves for BLACK for the given chessboard with 2 players and depth: 5
AIWorker.exec("getBestMoves", chessboard.getBoard(), COLORS.BLACK, 5, 10);
AIWorker.on("moves", moves => {
// Received Moves array of
// {
// from: "a2",
// to: "a4"
// }
});
The example use of the AI is available in the repo under examples/ folder.
Apache 2.0
Open an issue!
FAQs
Simple Chess AI for @chesslib/core
The npm package @chesslib/ai receives a total of 2 weekly downloads. As such, @chesslib/ai popularity was classified as not popular.
We found that @chesslib/ai 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.