You won!!

About the project

It is my first larger JavaScript project and first game using this technology.
I tried to make AI that would work with only JavaScript.
I made it without any tutorial so it can't be compared to real bots, but still I'm really proud of the outcome.

How it works

The AI loops for every pawn searching for the ones that can move.
Using function Math.random() it picks one of them, then checks possible XY directions and again chose one of them.
Finally using same random function, it chooses how many fields it will move and then will appear in this field.
However if the AI finds that choosen pawn can take a players pawn it will prioritize this move over moving in random field.
Second exception is when AI finds that its king is in danger, then it will try to move him.
y8
y7
y6
y5
y4
y3
y2
y1
x1
x2
x3
x4
x5
x6
x7
x8