Shatranj icon

Shatranj For Linux

3.5/5 51
GPL    

Shatranj is an bitboard-based, Open-Source, interactive chess programming module.. #Chess programming  #Search algorithms  #Chess engine  #Shatranj  #Chess  #Engine  

Description

Free Download

Shatranj is an bitboard-based, Open-Source, interactive chess programming module which allows manipulation of chess positions and experimentation with search algorithms and evaluation techniques. Shatranj's goal is to write a toolkit to aid in implementing Shannon Type B chess programs.

As such, execution speed becomes less important then code clarity and expressive power of the implementation language. Having been written in an interpreted language, this module allows the chess programmer to manipulate bitboards in a natural, interactive manner much like signal processing toolkits allow communication engineers to manipulate vectors of sounds samples in MATLAB.

The module currenly implements a simple recursive minimax search with alphabeta pruning, iterative deepening, uses short algebraic notation, handles repetition check, and the 50 move rule. Features lacking are quiescent checks, transition tables, negascout and MTD searching.

The chess programming toolkit is available in the form of a Python module called shatranj.py. You will also likely need the opening book as well as some of the pre-built hash tables that are used throughout the module (these will be recalculated if the module cannot find the data file).

Place all three file in the same directory and simply run python on the python module ("python shatranj.py"). As far as requirements, all that is needed is a recent version of the interpreted, high level language called Python (anything after version 2.3 should work fine). If you would like a little bit of a speed boost, shatranj looks for the module Psyco and will use it if it is installed.

Until more documentation becomes available, here is a short sample session: [Sam-Tannous-Computer:~/shatranj] stannous% python

>>> from shatranj import * ...reading startup data ...total time to read data 0.0774528980255 ...found opening book shatranj-book.bin with 37848 positions >>> position = Position("r1bqk2r/pppp1ppp/2n5/5N2/2B1n3/8/PPP1QPPP/R1B1K2R") >>> all_pieces = position.piece_bb["b_occupied"] | position.piece_bb["w_occupied"] >>> other_pieces = position.piece_bb["b_occupied"] >>> from_square = c4 >>> wtm = 1 >>> mask = position.pinned(from_square,wtm) >>> ne_pieces = diag_mask_ne[from_square] & all_pieces >>> nw_pieces = diag_mask_nw[from_square] & all_pieces >>> moves = ((diag_attacks_ne[from_square][ne_pieces] & other_pieces) | ... (diag_attacks_ne[from_square][ne_pieces] & ~all_pieces) | ... (diag_attacks_nw[from_square][nw_pieces] & other_pieces) | ... (diag_attacks_nw[from_square][nw_pieces] & ~all_pieces)) & mask >>> >>> moves 1275777090846720L >>> >>> tobase(moves,2) '100100010000101000000000000010100000000000000000000' >>> display(moves)

+---+---+---+---+---+---+---+---+ 8 | | . | | . | | . | | . | +---+---+---+---+---+---+---+---+ 7 | . | | . | | . | 1 | . | | +---+---+---+---+---+---+---+---+ 6 | 1 | . | | . | 1 | . | | . | +---+---+---+---+---+---+---+---+ 5 | . | 1 | . | 1 | . | | . | | +---+---+---+---+---+---+---+---+ 4 | | . | | . | | . | | . | +---+---+---+---+---+---+---+---+ 3 | . | 1 | . | 1 | . | | . | | +---+---+---+---+---+---+---+---+ 2 | | . | | . | | . | | . | +---+---+---+---+---+---+---+---+ 1 | . | | . | | . | | . | | +---+---+---+---+---+---+---+---+ a b c d e f g h

>>> position.show_moves(1) ['Rg1', 'O-O', 'f3', 'a3', 'Rb1', 'f4', 'Ba6', 'Bh6', 'Bd3', 'Qg4', 'Qe3', 'Ne7', 'Be6', 'Nxg7', 'Qxe4', 'Ne3', 'b4', 'Nh4', 'b3', 'Be3', 'Bg5', 'g3', 'Kf1', 'Rf1', 'Nh6', 'a4', 'Ng3', 'Qh5', 'Kd1', 'h4', 'h3', 'c3', 'Bxf7', 'Nd6', 'Bb5', 'Nd4', 'Qf3', 'g4', 'Qf1', 'Bb3', 'Qd1', 'Qd3', 'Qd2', 'Bd5', 'Bd2', 'Bf4'] >>> >>> # now play a game! >>> play()

Shatranj version 1.10 g: switch sides m: show legal moves n: new game l: list game record d: display board b: show book moves sd: change search depth (2-16) default=5 q: quit

Shatranj: d

+---+---+---+---+---+---+---+---+ 8 | r | n | b | q | k | b | n | r | +---+---+---+---+---+---+---+---+ 7 | p | p | p | p | p | p | p | p | +---+---+---+---+---+---+---+---+ 6 | | . | | . | | . | | . | +---+---+---+---+---+---+---+---+ 5 | . | | . | | . | | . | | +---+---+---+---+---+---+---+---+ 4 | | . | | . | | . | | . | +---+---+---+---+---+---+---+---+ 3 | . | | . | | . | | . | | +---+---+---+---+---+---+---+---+ 2 | P | P | P | P | P | P | P | P | +---+---+---+---+---+---+---+---+ 1 | R | N | B | Q | K | B | N | R | +---+---+---+---+---+---+---+---+ a b c d e f g h

Shatranj 1.17

add to watchlist add to download basket send us an update REPORT
  runs on:
Linux
  filename:
shatranj-1.17.tar.gz
  main category:
Games
  developer:
  visit homepage

4k Video Downloader 1.5.3.0080 Plus / 4.30.0.5655

Export your favorite YouTube videos and playlists with this intuitive, lightweight program, built to facilitate downloading clips from the popular website
4k Video Downloader

Windows Sandbox Launcher 1.0.0

Set up the Windows Sandbox parameters to your specific requirements, with this dedicated launcher that features advanced parametrization
Windows Sandbox Launcher

IrfanView 4.67

With support for a long list of plugins, this minimalistic utility helps you view images, as well as edit and convert them using a built-in batch mode
IrfanView

Zoom Client 6.0.3.37634

The official desktop client for Zoom, the popular video conferencing and collaboration tool used by millions of people worldwide
Zoom Client

Context Menu Manager 3.3.3.1

Customize Windows’ original right-click context menu using this free, portable and open-source utility meant to enhance your workflow
Context Menu Manager

calibre 7.9.0

Effortlessly keep your e-book library thoroughly organized with the help of the numerous features offered by this efficient and capable manager
calibre

Bitdefender Antivirus Free 27.0.35.146

Feather-light and free antivirus solution from renowned developer that keeps the PC protected at all times from malware without requiring user configuration
Bitdefender Antivirus Free

Microsoft Teams 24060.3102.2733.5911 Home / 1.7.00.7956 Work

Effortlessly chat, collaborate on projects, and transfer files within a business-like environment by employing this Microsoft-vetted application
Microsoft Teams

ShareX 16.0.1

Capture your screen, create GIFs, and record videos through this versatile solution that includes various other amenities: an OCR scanner, image uploader, URL shortener, and much more
ShareX

7-Zip 23.01 / 24.04 Beta

An intuitive application with a very good compression ratio that can help you not only create and extract archives, but also test them for errors
7-Zip

% discount
Microsoft Teams
  • Microsoft Teams
  • ShareX
  • 7-Zip
  • 4k Video Downloader
  • Windows Sandbox Launcher
  • IrfanView
  • Zoom Client
  • Context Menu Manager
  • calibre
  • Bitdefender Antivirus Free
essentials


Click to load comments
This enables Disqus, Inc. to process some of your data. Disqus privacy policy