News for hackers. Stuff that matters.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by Kharacternyk on Thursday November 30, 2023 @02:42PM (#38478117)
The bot is not very good, unfortunately. It's mainly useful to help understand the rules, as in your case. If you're interested in playing with an experienced player, ping me at [email protected] :)

> Which is the standard lenght of the turns?

The usual setup is a 10×10 grid with 3 moves per turn. More moves means more interesting manoevres are possible. I like 7 moves on 12×12.

Re:Show HN: Play a pen-and-paper game that is almost unknown... by gus_massa on Thursday November 30, 2023 @03:16PM (#38478498)
> It's mainly useful to help understand the rules, as in your case.

I agree.

[spoiler alert]

I tried with 2 or 3 moves per turn. My strategy was to advace in diagonal to have a lot of space in tha back, and keep some distance from the oponent. When it advances, I wall the pieces. If it doesn't advance I fill my backshard space. With 2 or 3 it's humanly learnable in 10 minutes. I imagine that 7 moves would be much ore complex, but sadly I have no time now.

Perhaps you can progem the bot to advance more in the first few turns. (Assuming my strategy is good.)

Re:Show HN: Play a pen-and-paper game that is almost unknown... by Kharacternyk on Thursday November 30, 2023 @04:27PM (#38479403)
Your strategy is definitely good — capturing territory to fill it later when advancing doesn't make sense is important. 7 moves are more complex, but much less so when playing against the bot.

Your suggestion about making the bot eager to advance makes sense, thanks. Hope you'll play a few times against a human opponent in the future:)

Re:Show HN: Play a pen-and-paper game that is almost unknown... by gus_massa on Thursday November 30, 2023 @08:16PM (#38481689)
Two small sugerstions:

* Make a small pause as if the bot is thinking each move. Probably .1 or .2 seconds is enough and not boring. We made a few games a long time ago, and a small pause makes it easier to understand the rules.

* When the game finished, I still can see my token as if I can draw it. It's very confusing until I notice the congratulations message. Don't show the token whe the game ended.

Re:Show HN: Play a pen-and-paper game that is almost unknown... by leowwwa on Friday December 01, 2023 @03:27AM (#38484480)
Hey everyone! This game brings back memories from my school days. While I'm engrossed in exploring wow classic season of discovery gold https://wowvendor.com/en-us/wow-classic/product/classic-era-... in the world of warcraft, it's fascinating to see this unique game getting attention. Nostalgia indeed has a way of connecting people through shared experiences! Thanks for sharing this, Kharacternyk.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by Jorge1o1 on Thursday November 30, 2023 @06:34PM (#38480799)
So the source code of the bot is here: https://github.com/Kharacternyk/paper-tactics/blob/master/pa...

It seems like there's an evaluation function but there's no state search / recursive minimax tree for the bot.

I think if we added a 10-ply lookahead minimax algo for the bot here it would be pretty good. [1]

I will probably do it myself if I end up having a bit of free time this weekend.

[1] https://en.wikipedia.org/wiki/Minimax#Minimax_algorithm_with...

Re:Show HN: Play a pen-and-paper game that is almost unknown... by quickthrower2 on Thursday November 30, 2023 @09:36PM (#38482336)
Good old Alpha Beta pruning. I have a real mental block whenever I try to code that algorithm!
Re:Show HN: Play a pen-and-paper game that is almost unknown... by tmountain on Friday December 01, 2023 @10:42AM (#38488042)
Monte Carlo tree search is another “easy” way to build a decent AI for a game. I love it because you simply define the rules of the game in a purely functional way, and it does the rest.

https://en.m.wikipedia.org/wiki/Monte_Carlo_tree_search

Re:Show HN: Play a pen-and-paper game that is almost unknown... by radarsat1 on Friday December 01, 2023 @02:26PM (#38491049)
I was wondering about the architecture because I want to be able to make little games like this, so I'm super happy to see the source here, thanks for posting it! And looks like you put a lot of thought into the architecture too, going to study it.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by solidr53 on Thursday November 30, 2023 @07:53PM (#38481508)
Seems like a great opportunity to train a neural network model for bot. There is a good article on tic tac toe for a base https://nestedsoftware.com/2019/12/27/tic-tac-toe-with-a-neu...
Re:Show HN: Play a pen-and-paper game that is almost unknown... by im3w1l on Thursday November 30, 2023 @08:03PM (#38481590)
I'd say the bot is very weak. My first game I had no real idea what I was doing. Half the game I thought I had to maintain contact with my starting square or lose, until I managed to wall in my opponents starting square and didn't win. Then I tried to make as many walls as I could because I didnt like my pieces being captured and walls seemed more solid. Suddenly it said I won and I was like wait how, turns out I had managed to turn every circle into a wall except the walled in starting square.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by Kharacternyk on Friday December 01, 2023 @04:16AM (#38484786)
Yes, very weak is probably a better description. I haven't learnt the theory behind AI opponents properly yet, so this bot is essentially a weighted random choice.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by im3w1l on Saturday December 02, 2023 @12:30PM (#38500183)
Now I feel negative. The rest of the implementation was very nice. Pretty ui and everything worked well.
Re:Show HN: Play a pen-and-paper game that is almost unknown... by gus_massa on Saturday December 02, 2023 @08:06PM (#38503842)
My guess is that for 1, 2 or 3 moves per turn it's possible to make a bot that looks ahead 2 or 3 rounds using brute force and then use AB pruning to pick the best move.

With 7 moves per turn the search space is too big and it looks difficult.

I tried a few games with neutral pieces, and it' move difficult to beat the bot.