# Working Bot Tic-Tac-Toe

**URL:** <https://forum.makecode.com/t/working-bot-tic-tac-toe/45138>\
**Category:** Show & Tell\
**Created:** [July 30, 2026, 5:04pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138 "2026-07-30T17:04:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fitz/32/34742_2.png) [@Fitz](https://forum.makecode.com/u/Fitz)\
**Post date:** [July 30, 2026, 5:04pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/1 "2026-07-30T17:04:36Z")

</div>

> **[Tic-Tac-Toe (Working Bot)](https://arcade.makecode.com/S43329-86455-88385-56334)**
>
> Tic-Tac-Toe with a working bot! It detects if you can win and where, then it blocks you, and it detects the same for itself and tries to win.

I made tic-tac-toe with a working bot!

Heres how it works:

The bot knows all winning patterns, if it detects you have 2/3 in any pattern, it will place an X wherever it calculates the 3rd one to be, and it works the same for it’s own placement. If you do not have any pattern, or only one placement, it will randomly place itself on the grid.

---

<div class="post-metadata">

**Author:** ![Rune](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rune/32/18951_2.png) [@Rune](https://forum.makecode.com/u/Rune)\
**Post date:** [July 30, 2026, 8:06pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/2 "2026-07-30T20:06:10Z")

</div>

This is quite cool. Though I did beat it easily (because I’m just that brilliant) it clearly shows your skill at coding. Good job!

---

<div class="post-metadata">

**Author:** ![Fitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fitz/32/34742_2.png) [@Fitz](https://forum.makecode.com/u/Fitz)\
**Post date:** [July 30, 2026, 10:30pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/3 "2026-07-30T22:30:01Z")

</div>

thanks!

---

<div class="post-metadata">

**Author:** ![Vincent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vincent/32/31472_2.png) [@Vincent](https://forum.makecode.com/u/Vincent)\
**Post date:** [July 30, 2026, 10:30pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/4 "2026-07-30T22:30:49Z")

</div>

This is very good! =) I tested what you said, looked at the code and proceeded to crush the AI 10 times.

---

<div class="post-metadata">

**Author:** ![Fitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fitz/32/34742_2.png) [@Fitz](https://forum.makecode.com/u/Fitz)\
**Post date:** [July 31, 2026, 2:12am UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/5 "2026-07-31T02:12:35Z")

</div>

yea it’s not the best but it’s still pretty good

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [July 31, 2026, 2:20am UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/6 "2026-07-31T02:20:32Z")

</div>

yay I won!

 ![Screenshot_20260730-142736](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/6/3698d9157eb94a37f41572280bdcfd1016c63cab.png)

I did top-left, top-right, bottom-right

---

<div class="post-metadata">

**Author:** ![teaeat100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/teaeat100/32/33097_2.png) [@teaeat100](https://forum.makecode.com/u/teaeat100)\
**Post date:** [July 31, 2026, 4:56pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/7 "2026-07-31T16:56:53Z")

</div>

I won!

Top left, middle left & middle  
(I uh . . . Can’t put a image on mobile)

---

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [July 31, 2026, 4:57pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/8 "2026-07-31T16:57:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/d/7d2afb4567909a6b04e44b116614b3cae370138c.png)

wow that is a lot of code for a tic-tac-toe game

---

<div class="post-metadata">

**Author:** ![Fitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fitz/32/34742_2.png) [@Fitz](https://forum.makecode.com/u/Fitz)\
**Post date:** [August 1, 2026, 1:19am UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/9 "2026-08-01T01:19:27Z")

</div>

yea it was hard to get it working, so i needed a lot of functions

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [August 1, 2026, 11:37pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/10 "2026-08-01T23:37:36Z")

</div>

you can put an image in mobile (im using mobile at this moment too)

 ![Screenshot_20260731-214134](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/8/18d3f00ad28cb02c73bcc589422c505081af1381.png)

---

<div class="post-metadata">

**Author:** ![Air](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/air/32/26413_2.png) [@Air](https://forum.makecode.com/u/Air)\
**Post date:** [August 1, 2026, 11:40pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/11 "2026-08-01T23:40:58Z")

</div>

i will forever remain the victor

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/0/404e5612a86425978b05e430cb859bcda2428493.png)

---

<div class="post-metadata">

**Author:** ![javascriptnerd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/javascriptnerd/32/35334_2.png) [@javascriptnerd](https://forum.makecode.com/u/javascriptnerd)\
**Post date:** [August 1, 2026, 11:42pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/12 "2026-08-01T23:42:18Z")

</div>

it… learns

---

<div class="post-metadata">

**Author:** ![teaeat100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/teaeat100/32/33097_2.png) [@teaeat100](https://forum.makecode.com/u/teaeat100)\
**Post date:** [August 3, 2026, 5:12pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/13 "2026-08-03T17:12:13Z")

</div>

I was using the email link, unsure if that doesnt allow them or not

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [August 3, 2026, 7:42pm UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/14 "2026-08-03T19:42:56Z")

</div>

you mean you were sending a post through Gmail? There should still be an image button at the top

---

<div class="post-metadata">

**Author:** ![teaeat100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/teaeat100/32/33097_2.png) [@teaeat100](https://forum.makecode.com/u/teaeat100)\
**Post date:** [August 5, 2026, 2:26am UTC](https://forum.makecode.com/t/working-bot-tic-tac-toe/45138/15 "2026-08-05T02:26:09Z")

</div>

🤷 (sentence)
