Curses-Simp
view release on metacpan or search on metacpan
bin/trng/trng view on Meta::CPAN
#!/usr/bin/perl
# 643B19t-649FOrQ: trng by PipStuart <Pip@CPAN.Org> as a Simp Tringo clone
# Board is 5x5 (like Bingo).
#
# Pieces:
# * *
# @ @ @* @ @ @* *@
# * * *
#
# * * * * *
# @* *@ *@* @ *@* @ @
# * * * * * * *
#
# * ** * * ** * *
# @ @ *@* @ *@* *@ @*
# * ** ** * * * *
#
# * * * *
# *@ @* *@* *@ *@* @* @
# ** ** * * * **
#
# ** * * * **
# *@* @ *@* @ *@* @ *@*
# * * ** * *
#
# It should be easy to play normally or to choose to pick the piece that came up
# in a Second Life game (for logging or input advice). Maybe then the
# possibilities could be exhausted && suggestions could be made for blocks &&
# positioning most likely to allow any next piece to be successfully placed &&
# secondarily to get big boxes.
#
# Exhaustion should be done in C because there are too many possibilities for
# Perl to be fast enough. Also have option for just random moves with heuristic
# for devaluing branches that make pieces unplaceable and valuing high scoring.
#
# Beyond re-implementation of Tringo, some other derivative ideas:
#
# Trisgo - S for Speed (&& Selection?) where random order is chosen at start,
# players get bonus for finishing quickly, can undo moves, games start
# automatically 1 minute after the first player pays (or enters if no
# pay-to-play)
# options: pay-to-play, min bet, max bet, show contributors, early bonus
# scale (where eventually nobody can catch the first finisher), Selection
#
# Tricko - C for Children (K for Kids) is like Trisgo except:
# play is free (maybe house always contributes L$1 to each pot or something)
# there is no per-move time-limit (but maybe cap games to 10-minute)
# players can toggle hints
# players can rotate pieces
# players can flip pieces
#
# Tango - Two-player cooperative variation?
# One player places new pieces while the other can toggle up to two board
# blocks each turn (effectively able to relocate any grid piece by turning
# one off and it back on somewhere else as well as removing up to two
# problem pieces or creating two advantageous ones)
#
# Tingo - Two-player competitive variation?
# Maybe like Tango except that each player places regular pieces on their
# own board, then they each toggle one grid piece of their opponent's
# board (trying to mess them up), each has seven undo tokens which, when
# used, prevent the opponent from toggling the same grid unit as they did
# before, maybe bonuses for unused undo tokens, winner has higher score,
# players are head-to-head for their own pot, maybe players need to be
# able to rotate or flip pieces (or both)
#
# Maybe have Tango and Tingo tournaments w/ in-SL sponsorships for prizes/L$.
#
# Spectators should be allowed to contribute to the pot or create their own
# side bets.
#
# I should make up many more 2-player competitive versions (maybe Sirlin would
# like to help).
#
# Board is 5x5 (like Bingo). Pieces: @ @
# X X X@ X X X@ @X
# @ @ @
#
# @ @ @ @ @
# X@ @X @X@ X @X@ X X
# @ @ @ @ @ @ @
#
# @ @@ @ @ @@ @ @
# X X @X@ X @X@ @X X@
# @ @@ @@ @ @ @ @
#
# @ @ @ @
# @X X@ @X@ @X @X@ X@ X
# @@ @@ @ @ @ @@
#
# @@ @ @ @ @@
# @X@ X @X@ X @X@ X @X@
# @ @ @@ @ @
# notz: within about a minute from start, takes 675MB with 1,161,202 kids to depth 2
# 2do:
# mk Curses quit cleaner (i.e., without requiring `reset` && pal restore) maybe up in Simp
# re-enable RecuDpth with bottom while(0&&
# enhance visible exhaustion && fix bug that upper-left is only result returning from BestPlac()... maybe using $rndx instead of $pick->[0] somewhere?
# maybe $tbrd is getting both real && exhaustion data at once? maybe recursion limits are off-by-one?
# mk BestPlac() determine initial piece position && then another key will update it again (so I won't have to fight it for early dumb placements)
# compress xhst array-set data further into b64 values for at least plst && bord if not actual_ndx && flags together too (kid_coun,heur_val,[kids],scor sep)
# try binary instead of b64
# port RecuDpth to multi-threaded C through Open2 or Inline
# mk basic heuristic with phases:
# 0) early game - heavily avoids exploring discard branches, lightly avoids making 4s, sets up strong guaranteed 6s with good chances for 9s
# 1) late game - explores all uniformly
# fix undo bugs (test in RandPick mode $rflg == 1 too)
# dump XML action logs w/ pt-stamps
# mk pgrd blox 3x2 in double-draw mode && add triple
use strict;
use warnings;
use Curses::Simp;
use Games::Cards::Poker;
use Math::BaseCnv qw(:all);
( run in 0.446 second using v1.01-cache-2.11-cpan-71847e10f99 )