News for hackers. Stuff that matters.
Re:Show HN: Probabilistic Tic-Tac-Toe by janwillemb on Monday June 10, 2024 @02:22PM (#40636495)
Nice! And irritating! I would make it a lot faster though. It takes so much time waiting for the animations to finish.
Re:Show HN: Probabilistic Tic-Tac-Toe by JKCalhoun on Monday June 10, 2024 @02:24PM (#40636523)
Too much time to load too (ditch the overkill 3D engine, there are lighter frameworks out there).

Cool game though. I am still puzzled by how the probabilities are arrived at. Random?

Re:Show HN: Probabilistic Tic-Tac-Toe by igpay on Monday June 10, 2024 @03:59PM (#40638084)
Agreed that 3D is overkill. I'm fastest at prototyping in Unity though and this was only a couple day project, so I'm unlikely to port it to anything else.

Probabilities are mostly randomized during board generation but skewed in a way to make gameplay feel a bit better. There's a cap on the likelihood of the neutral event, and a bias towards the good event rather than a bad one.

Re:Show HN: Probabilistic Tic-Tac-Toe by zachmu on Monday June 10, 2024 @04:10PM (#40638292)
I got the die to settle on an edge in the corner of the playfield, which triggered a re-roll.

Is this actually simulating a d20 with physics?

Re:Show HN: Probabilistic Tic-Tac-Toe by Laremere on Monday June 10, 2024 @08:26PM (#40640908)
Can you please share the specifics? I'm trying to make my own AI for this game, and would like to compare mine against random play to estimate its strength.

Also, in your listing of your ai beating the random, how are you counting drawn games?

Re:Show HN: Probabilistic Tic-Tac-Toe by igpay on Tuesday June 11, 2024 @12:17AM (#40642279)
The current code for board generation is as follows:

  var neutralChances = Random.Range(1, MaxNeutralChances + 1);
  square.GoodChances = Random.Range(MinGoodChances, 20 - neutralChances);
  square.BadChances = 20 - (square.GoodChances + neutralChances);
MaxNeutralChances and MinGoodChances are both set to 6 in the release build. Note that one chance is equal to one face of the die, so 5%. Also, this overload of Random.Range() has an inclusive min value but an exclusive max value.

I guess I didn't include ties in that little blurb I wrote up, but the real results of my 10k trials were around 5:1:11.5 (lose:tie:win) for the AI vs random actor.

Would love to see your AI when it's done! Please shoot me an email if you want. My email is in my profile / in the site footer.

Re:Show HN: Probabilistic Tic-Tac-Toe by its_ethan on Monday June 10, 2024 @09:11PM (#40641185)
Why an AI? Just for the fun of implementing it (totally valid, just curious)? Given the probabilities of the outcomes couldn't you just "solve" for the best way to play it based on expected value?

If there are 65% and 50% to complete a row in one direction, and a 35% and 20% in another direction, you don't really need AI to tell you which one would be more advantageous to go after?

Re:Show HN: Probabilistic Tic-Tac-Toe by Laremere on Monday June 10, 2024 @09:23PM (#40641268)
Yes, I've made what is intended to be a perfect solver (Although it in some testing it's clearly making mistakes, so I have some debugging to do yet). I'm making it because I was nerd sniped into thinking through how to handle some of the trickiness with the solving. It's not an AI in the LLM or machine learning sense, but in the previously common use of the term (eg, deep blue), or in the video game sense.
Re:Show HN: Probabilistic Tic-Tac-Toe by its_ethan on Monday June 10, 2024 @09:45PM (#40641394)
Very cool! Best of luck working on it!
Re:Show HN: Probabilistic Tic-Tac-Toe by JKCalhoun on Wednesday June 12, 2024 @04:32PM (#40662774)
That's cool — use what you're comfortable with.

Myself, I am trying to create lightweight 3D code to sit on top of Canvas and HTML5. That may be why I was sensitive to the "overkill", ha ha.

https://github.com/EngineersNeedArt/Phosphor3D

Re:Show HN: Probabilistic Tic-Tac-Toe by omoikane on Monday June 10, 2024 @02:47PM (#40636812)
An extra click that would stop the animation immediately might be helpful.

Or to turn this into a different game: the d20 stops fast by default, but extra click to cheat and keep it rolling if you feel that it's about to stop on an unfavorable face.

Re:Show HN: Probabilistic Tic-Tac-Toe by SamBam on Monday June 10, 2024 @02:33PM (#40636610)
Agreed. Taking the time to roll the dice is important the first few times, to fully cement the idea of the game. After that it gets annoying.

To be specific, you could probably even leave the roll time as-is, to give you that suspense, but the time it takes to move the die to the center, flash it, and flash the result, is too long and gets irritating.

Re:Show HN: Probabilistic Tic-Tac-Toe by igpay on Monday June 10, 2024 @03:56PM (#40638046)
That's good feedback, thanks. I've added a fast forward button to the top left.
Re:Show HN: Probabilistic Tic-Tac-Toe by SV_BubbleTime on Monday June 10, 2024 @10:27PM (#40641644)
You overdid it.

1x is right at first, but 2x is really fast.

Re:Show HN: Probabilistic Tic-Tac-Toe by airstrike on Monday June 10, 2024 @10:40PM (#40641714)
3x is great
Re:Show HN: Probabilistic Tic-Tac-Toe by primitivesuave on Tuesday June 11, 2024 @11:35PM (#40654207)
I made some updates to speed up the UI, and improved the computer player, as I was interested in finding the optimal strategy: https://keshav.is/coding/pt3