Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Chess

Symbols

  • Chessboard
  • ChessboardQ
  • ChessboardRecognize
  • ChessGame
  • ChessGameQ
  • ChessViewer
  • EngineEvaluate
  • Engine
  • QuitEngine
  • RandomChessboard
  • RandomChessGame
  • StartEngine

Formats

  • FEN
  • PGN
Wolfram`Chess`
RandomChessGame
​
RandomChessGame
[n]
yields a
ChessGame
with at most
n
moves played at random from the initial position.
​
​
RandomChessGame
[n,metadata]
yields a
ChessGame
with specific values of metadata.
​
​
RandomChessGame
[n,metadata,fen]
yields a
ChessGame
started from the position described by
fen
.
​
Details and Options

Examples  
(2)
Basic Examples  
(1)
Generate a random game between Alice and Bob of up to a 100 moves:
In[1]:=
g=
RandomChessGame
[100,"White""Alice","Black""Bob"]
Out[1]=
ChessGame
Alice - Bob
Date: Fri 2 Jun 2023 10:25:29

Browse the game:
In[2]:=
ChessViewer[g]
Out[2]=
Alice
–
Bob
Fri 2 Jun 2023 10:25:29, Wolfram
*
Wolfram`Chess`MLE`ChessBoard`NewBoard[rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1][Wolfram`Chess`MLE`ChessBoard`toGraphics[ImageSize250,Arrows{},
HighlightSquares{}]]
1.
a4
f6
2.
e3
h5
3.
Qe2
Na6
4.
Ra3
b5
5.
Qxb5
Rh7
6.
Bc4
e6
7.
h4
Rh8
8.
b4
Nc5
9.
Ne2
Nd3+
10.
Kd1
Nh6
11.
Qb6
d6
12.
Qc6+
Bd7
13.
Rg1
Bxc6
14.
Ba2
Nf4
15.
Bd5
Bb7
16.
Bb3
Ng8
17.
Bc4
a6
18.
Ke1
Rc8
19.
e4
Nd3+
20.
cxd3
Ra8
21.
Bb2
Kf7
22.
a5
Rb8
23.
Nc1
Bd5
24.
Ra4
Qe8
25.
Ba2
Qxa4
26.
Bd4
g5
27.
Be3
gxh4
28.
Bxd5
Rb5
29.
Rf1
Rb8
30.
g4
Ke7
31.
f4
Qa1
32.
Bb6
Qe5
33.
Bc5
Bg7
34.
Ke2
Kd7
35.
Kf2
Qxe4
36.
Na3
Rb5
37.
Ne2
Qe3+
38.
Bxe3
Nh6
39.
Nd4
Kc8
40.
Bg2
Rd5
41.
b5
h3
42.
Ke1
Rc5
43.
Nf5
Rxb5
44.
Rf2
Re5
45.
d4
Kd8
46.
Kd1
d5
47.
Rf1
Ke8
48.
Bh1
Rxf5
49.
gxf5
Kf8
50.
Rf3
Ke8
Move 0 out of 50
≪
<
>
≫
Scope  
(1)

SeeAlso
ChessGame
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com