> For the complete documentation index, see [llms.txt](https://freedom-developer.gitbook.io/the-chess/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freedom-developer.gitbook.io/the-chess/importing-stockfish-ai.md).

# Importing Stockfish AI

Stockfish is a very powerful chess position analytic chess engine, well-known by the chess community. I did make it as a plug and use AI Engine awhile ago on top of [The Coolest Chess](https://assetstore.unity.com/packages/templates/packs/the-chess-210928), it supports up to five major platform including Windows, MacOS, Android, WebGL and iOS

{% hint style="info" %}
**For those who do not own The Coolest Chess Asset Store package, it's reluctant to read this section. The** [**official Stockfish website**](https://github.com/official-stockfish/Stockfish) **can be found on the link.** &#x20;
{% endhint %}

***

## **The Coolest Chess + Stockfish AI**

**The prepared scene for Stockfish**

There is one scene made as a demonstration of using Stockfish with The Coolest Chess package named ChessWithStockfish. **In order for this scene to work, Stockfish must be imported from github page.**

**Instruction on how to import Stockfish to Unity**

<figure><img src="/files/c0ygyOzWYTpPZwSJrGu6" alt=""><figcaption></figcaption></figure>

Go to Windows -> Package Manager. Then select + dropdown button and then select Add package from git URL as shown in the gif above. Copy and paste the Stockfish dependency url **<https://github.com/githubvickson/sf.git>** to the input field and click Add button, the dependency will be added to Packages folder automatically. The ChessWithStockfish scene is ready at this stage. However, **for WebGL, there are a bit more work to be done**.

If things go right, you will see these results.

<figure><img src="/files/kpUxP8afQwpMgX8omAhP" alt=""><figcaption></figcaption></figure>

## **WebGL Setup**

1\) Move WebGLTemplates folder to root folder, it is necessary for when building the index.html containing working Stockfish.

<figure><img src="/files/RmZTx8qRcTp7UV56UkC7" alt=""><figcaption></figcaption></figure>

2\) Copy files from the dependency installed into StreamingAssets folder

In folder Packages\Multiplatform ChessStockfish AI\jsfiles, copy all of the files inside the folder to Assets\StreamingAssets folder, do it by using copy and paste through Windows File Explorer, dragging into Unity Editor project tab won't work. Look at gif below for visualisation.

<figure><img src="/files/AIlDFFumxYrZ47Cp2EKV" alt=""><figcaption></figcaption></figure>

3\) In order for build to show up the index.html from WebGLTemplates folder,&#x20;

From Unity Editor Toolbar, select Edit -> Project Settings -> Player -> WebGL settings(the one with html 5 icon) -> Resolution and Presentation -> WebGL Template -> from Default switch to stockfish. Check gif below for visualisation. Everything is done at this stage, Stockfish in WebGL build will work just fine at this point.

<figure><img src="/files/p2UU5BndTDmXtIt2q6fJ" alt=""><figcaption></figcaption></figure>

## **Tested Settings**

{% hint style="info" %}
Tested Skill And Time Settings (Note that the purpose of skill is to enhance the AI to make moves without blunder while time is to allow it to see through future if the move are the best)

```
(skill : -20.0, time : 1.0) //500~600 ELO
(skill : 0.0, time : 20.0) //1350 ELO
(skill : 2.0, time : 20.0) //1550 ELO
(skill : 5.0, time : 20.0) //1650 ELO
(skill : 10.0, time : 20.0) //1750 ELO
(skill : 13.0, time : 20.0) //1820 ELO
(skill : 15.0, time : 20.0) //1870 ELO
(skill : 17.0, time : 20.0) //1920 ELO
(skill : 20.0, time : 20.0) //2050 ELO
(skill : 15.0, time : 100.0) //2150 ELO
(skill : 17.0, time : 100.0) //2300 ELO
(skill : 18.0, time : 100.0) //2400 ELO
(skill : 19.0, time : 100.0) //2500 ELO
(skill : 20.0, time : 100.0) //2600 ELO
(skill : 17.0, time : 1000.0) //2680 ELO
(skill : 18.0, time : 1000.0) //2780 ELO
(skill : 19.0, time : 1000.0) //2880 ELO
(skill : 20.0, time : 1000.0) //2980 ELO
(skill : 20.0, time : 3000.0) //3100 ELO
```

{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://freedom-developer.gitbook.io/the-chess/importing-stockfish-ai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
