r/perl • u/saiftynet 🐪 cpan author • 12d ago
The MiniMax Algorithm
https://github.com/saiftynet/TIC-TAC-TOE1
u/Crafty_Fix8364 10d ago
The only inline comment is obvious. What is it with perl-folks and comments?
Edit:spelling
1
u/saiftynet 🐪 cpan author 10d ago
The only real thing to say is that when I searched for MiniMax and Perl, there were no examples "in-the-wild". Browser connected AIs offered to create the Perl code for me, and interestingly they all seemed to be inefficient ports of Python or Javascript code...I imagine one has to to "think in Perl" to create better Perl programs. Line-by-line translation of Python into Perl is just not going to cut it.
1
u/tarje 10d ago edited 10d ago
Did you search metacpan? Results include Games::Checkers and Games::AlphaBeta, both of which use the algorithm.
2
u/saiftynet 🐪 cpan author 9d ago edited 9d ago
Embarrassed now. I had just googled it in relation to TicTacToe thinking it was the most obvious demo use case instead of doing the obvious. Thanks for that!
3
u/saiftynet 🐪 cpan author 12d ago
Was looking to explore the MiniMax algorithm. Hadn't come across a Perl version, and many non-Perl versions seem cumbersome. Here is an implementation to solve 3x3 TicTacToe