[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Tic Tac Toe

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 4

File: How_to_win_ttt.png (4MB, 1644x1992px) Image search: [Google]
How_to_win_ttt.png
4MB, 1644x1992px
I don't know if /v/ is the place for tic tac toe. but I'm really happy I could program an extended/nested version of it.

The normal tic tac toe is boring once you know how to always win (or at least not lose)

But extending it to 9x9 makes it interesting.

Here I programmed a 9x9 version:
https://github.com/Pella86/ExtendedTris

For windows users I could bundle it up in a executable availble in this .zip:
https://github.com/Pella86/ExtendedTris/blob/master/ExtendedTris.zip
>>
>>384048679
In britbong its 'noughts and crosses'. Is it just tic tac toe in America or everywhere else?
>>
>>384049038
In italian is Tris, this is why the program is called Extended Tris
>>
>>384049038
Ex's and Oh's is also a common name for it in north america at least.
>>
File: Playerwin.png (97KB, 542x656px) Image search: [Google]
Playerwin.png
97KB, 542x656px
>>384048679
I am trying to design an AI, for now the AI is fully random.

Can you help me? Any suggestion would be appreciated, I'll try to implement it by coding what you say.
>>
>>384049516
Do you wish this to be a difficult AI that's not really an AI or an easy to beat AI that's an actual AI?

Option 1:
Do a state search for each possible move up to a certain depth (more depth for more difficulty but longer runtime inbetween moves).

Option 2:
Make an AI that would learn to grade the viability of moves and store it's knowledge in persistent data files and would then learn from each attempt which moves are more likely to lead towards victory.
>>
>>384050084
I didn't even thought about it.

I would have liked to make the best AI possible. It's easy to weaken AI with random.

>Option 1
what is a state search if you care to explain?

>Option 2
This is resource intensive but doable!
>>
File: Help menu.png (660KB, 1323x992px) Image search: [Google]
Help menu.png
660KB, 1323x992px
Instructions of the game
>>
When I was in high school me and a friend played a version of tic tac toe where you could "take over" an already claimed space once per game (after being taken over, it could not be re-taken over again, so you can't just go back and forth and waste your take over). Then we also had one "unblockable" move per game that couldn't be taken over.

It still devolves into a few different patterns after a while though.
>>
>>384051770
That could be implemented in the game

I will clean up my code, so other people can interact with it, so maybe there will be extensions
>>
>>384050782
"state search" is the term i used because i forgot the appropriate one. Basically what you do is you choose every possible move, then for each move you can take note of each move the human can make, then repeat the process if its possible for the computer to make another move after the human. In each iteration you check if it leads to a victory or loss. If a single move can lead to you making a victory without a chance for the human to do the same, it's a winning move. If a single move can lead to an option for the human to make a winning move, it's a losing move, whether the human takes the opportunity or not. However, in a 9x9 field, your first move has 81 possibilities, and then the human has 80, and then you can make 79 and so on. This is a lot of possibilities to consider, you can't possibly calculate all of them without the player dying of old age, so what you do is you set a limit to the depth of the search (say, you only try to predict the game for the next 5 turns) and regulate the difficulty of the game by increasing this depth (a computer that has insight into all possible outcomes of 9 moves in is of course harder to beat). This is a brute force approach, its not intelligent, but in turn it doesn't require a lot of knowledge to implement, its simple and very effective (in terms of difficulty it provides).

The AI approach is much more difficult and requires knowledge of computer science and you'll have to read into a lot of literature to build an algorithm that can learn and adjust, but i cant describe it all in one comment due to length cap.
>>
File: move1.png (69KB, 542x654px) Image search: [Google]
move1.png
69KB, 542x654px
>>384052526
Thank you for the extensive explanation!

I had in mind to do something like that, like a chess board, and then I realized that 81 > 64 and maybe it would be too slow.

Can you pinpoint maybe places where I can learn computer science for AI regarding this specific game? Like hidden markov models, neural networks, genetic algorithms, tree searches and so on?
>>
>>384053164
Well all the books on the topic go too broad and may just overwhelm you with information. In my opinion you should start elsewhere, for example some american colleges like iirc stanford or berkeley have their lessons posted online and are pretty good, if not them try digging around for other colleges, but in general they should give you a really good idea of the jist of it all. Better to use books just to look up specific information you can't find there and are interested in. Once you're very well versed in a certain topic, you may wanna look up whatever literature they referenced and read it to get a better understanding of the big picture. And if that's not enough to get you going and you really wanna try learning from a book straight away i can direct you to Artificial Intelligence by S. J. Russel and P. Norvig. It's a pretty big intimidating book but it has pretty much everything you need to get started.
>>
>>384054817
Thanks a lot!
Thread posts: 14
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.