The Patterns Game is an interactive game played via posts to the Patterns Game topic in the Sudoku Players forum. Although promoted as a game, there is a hidden agenda: a mechanism for generating and cataloging puzzles with interesting properties.
Patterns Game 2.0 is a continuation of the Patterns Game introduced by JPF, with a twist. This time around the refereeing and accounting is automated by a daemon, g.r.emlin, interacting as a forum member. The goal of the automation, besides being a neat programming exercise, is to take over the mistake-prone and tedious job of accounting, leaving the enjoyable parts to the human participants (assuming g.r.emlin is the only automaton in the game!) Almost all of the nuances of the game outlined below are malleable and open for discussion. The rules are based on JPF's original post.
ER ratings are based on Sudoku Explainer 1.2.1 (SE.) Current ERs fall in the range 1.0 through 13.0, with one digit in the tenths position.
Patterns Game ratings are the tuple ER/EP/ED:
- ER (explainer rating): the higest Sudoku Explainer rating of the methods leading to the puzzle solution
- EP (pearl rating): the higest Sudoku Explainer rating of the methods leading to the first cell placement
- ED (diamond rating): the higest Sudoku Explainer rating of the methods leading to the first candidate elimination
Ratings sort numerically from left to right, low to high. A pearl or diamond must have ER > 2.3.
A modified Sudoku Explainer 1.2.1 determines these ratings. (Note that some browsers may incorrectly change .jar suffixes to .zip when downloading; change the suffix back to .jar before using.) This version contains the standard SudokuExplainer entry point, but also provides a new command line entry point serate. See serate(1) for details. Use --format=%r/%p/%d to generate Patterns Game ratings. serate also works around anomalous java floating point representations by rounding all ratings to the tenths digit.
For this version of SudokuExplainer the rating 0.0 denotes puzzle input/initialization error and the rating 20.0 denotes either multiple solutions or a puzzle requiring unsupported methods.
For each game a dealer posts a 9x9 sudoku puzzle (the pattern) with the following properties:
- valid (by definition, but stated for completeness) (gsf-solver -e valid)
- minimal (gsf-solver -e minimal==1)
- 2 <= dihedral symmetry order <= 8 (gsf-solver -e 'symmetry>=2&&symmetry<=8')
- maximum dihedral symmetry order (no puzzle permutation has a higher dihedral symmetry order; must be: gsf-solver -qFN -f%#sc puzzle | gsf-solver -qFN -f'%(S)x')
- solvable by singles only (gsf-solver -qFN-G)
- 19 <= clues <= 29 (gsf-solver -e 'clues>=19&&clues<=29')
- clue pattern not isomorphic to (essentially different from) any previous pattern (gsf-solver -f%#xc)
Each player can post (submit) a new puzzle with the following properties:
- same pattern
- not isomorphic to any previous puzzle in the current game
- different ER from any previous puzzle in the current game or an ER/EP/ED greater than the highest submitted ER/EP/ED with the same ER by another player (a trump); trumping ones own entry (a self-trump) is not allowed
The dealer is selected by the referee (see below.) After making a submission a player may not make another submission until 10 minutes have passed and another player has made a submission. Game numbers 0 modulo 2 are lightning rounds (marked LIGHTNING) with the 10 minutes submission delay waived. In checking for consecutive posts by the same player, a syntactically correct submission is considered a submission, even if it is later tagged invalid. A duplicate submission within 2 minutes of the original submission is ignored (unless the duplicate is by the same player.) Within 5 minutes of an invalid submission the referee will post an ::: adjustment ::: message that contains the sumbmission date and reason for the adjustment.
The current game closes when any of the following occur:
- all but one of the active players (players who have made submissions) have resigned
- no valid submissions have been made for
- < 4 players: (4 days + 2 hours)
- >= 4 players: (22 hours + 2 hours)
The points for each submission is the ordinal of the submission: 1 point for the dealer, 2 points for the second submission, etc.
When the game closes all of the points are summed, per-player, with the following adjustments:
- add -20 for the dealer
- add submission ordinal for the last submission
- add submission ordinal plus 10% of the total score at the time of entry for the highest ER/EP/ED
- add submission ordinal plus 5% of the current total score for the last entry
- assign -50 for each invalid submission
- assign -50 for each submission marked edited
- assign -100 for each submission with ER/EP/ED that does not match the results of Sudoku Explainer 1.2.1
- assign -50 for each self-trump
- assign 0 for trumped submissions
- add EP/ED bonus of (5*(EP-2.3)+10*(ED-2.3))
- (25*(2-count+1)) for each non-trumped entry with ER/EP/ED count (from all previous games) <= 2
- (10*(2-count+1)) for each trumped entry with ER/EP/ED count (from all previous games) <= 2
- 0 plus EP/ED bonus of (SCORE_MORE?1:0)*(5*(EP-2.3)+10*(ED-2.3)) for each ::: more ::: puzzle (see below) posted in the time between the game close and the next game start
where assign means the submission only gets the assigned points (and does not participate in any other bonus scoring or labeling) and add means the points are added to the submission points. Trumped rarity bonuses are retained by the original submitter. The player with the highest point total is the winner.
Puzzle submission posts must be in 9x9 grid form with the ER/EP/ED ratings as ED=floating-point-number/floating-point-number/floating-point-number, EP=floating-point-number/floating-point-number/floating-point-number, or ER=floating-point-number/floating-point-number/floating-point-number, but no other adornments. As of Patterns Game 2.0 all three ratings must accompany a submission. The grid and rating must be in a [ code ] ... [ /code ] block with no font size/color adornments. Signature and other text may follow the code block.
Any player can request game status with a post containing ::: status ::: on a separate line. The referee posts status every 10 submissions, so this may be needed only when the game slows.
A player can resign with a post containing ::: resign ::: on a separate line. Resigned players cannot make submissions to the current game.
A resigned player can re-sign with a post containing ::: re-sign ::: on a separate line.
After the game is closed and before the next game starts players may post a batch of additional valid but unplayable puzzles for the closed game:
- Code: Select all
::: more :::
Unplayable puzzles include those cached by the last player and puzzles with a higher ER/EP/ED of an entry by the same player.
Use ::: comment ::: as the first line of a post that might otherwise be interpreted as a sumbission. This often happens when quoting or referring to submissions in the current or previous games.
::: patterns ::: on a separate line will list the patterns for all previous games.
A post containing ::: anything ::: before any font embellishments will not be interpreted as a submission.
The edited score adjustment does not apply to more messages.
The referee maintains a queue of candidate patterns. This queue is not perused by any of the players, even g.r.emlin's close friends. The queue contains a handful of generated puzzles just in case player candidates run dry. Players may submit one or more puzzles to the queue via a private message to g.r.emlin with the subject pattern and the message containing one or more lines of the form
- Code: Select all
A reply is sent for each pattern submission with either queued or rejected in the subject line. The message body will contain a reason for the rejection; there may be more than one reason, but the validation stops at the first invalid property detected. Messages with subjects other than exactly pattern are silently discarded. Except for the start state the referee private message inbox is checked every 2 hours.
Dealer submissions are maintained FIFO per dealer, and dealers are selected round robin. A dealer repeats in succession only if there are no dealer submissions from other players. If there are no player submissions in the queue then g.r.emlin selects one from a pre-generated list and it's your fault if its not a good game. Don't bombard the queue -- submissions, including yours, might be silently discarded.
The dealer selection for the next game is made when the game enters the start state. Dealer submissions made after the start state will be eligible for subsequent games.
It's OK to try to fool the referee up to a point (i.e., don't do things that would get you kicked off the forum or that you would be embarrassed to tell your mom.) It just becomes part of the debugging process.
It is definitely bad form for a dealer to cache entries before a puzzle is dealt. However, doing a trial run to check on the quality of a deal is fine, as long as the trial data is not used for game play.
The game is modeled as a state machine with submissions and elapsed time controling the transitions. All times are UTC (zulu). No provisions are made for waking/sleeping hours across time zones. The progression of games will eventually wash any time zone specific bias.
The states are:
- start: The referee selects a dealer and posts a message that the game will start in 16 hours.
- open: The referee posts the pattern and dealer id, and the game begins. A status message is posted after every 10 submissions.
- idle: After at least 3 entries have been made (the deal counts as entry 1) and 22 hours with no submissions (4 days if < 4 players) the referee posts a message that the game has gone idle and will close in 2 hours if there are no further submissions. If there is a submission within 2 hours the game goes back to the open state.
- closed: After (22 hours + 2 hours) (or (4 days + 2 hours) if < 4 players) idle, or when all but one of the active players have resigned, the referee posts a message that the game is closed. This message will include preliminary results. Players may post one or more ::: more ::: messages containing grids found after the game closed.
- final: (2 days+16 hours - 5 minutes) after closing the game enters the final state and the referee posts a final tally for the game that includes all scores and submitted puzzles. Once a game is final any edited submissions for the game are ignored. After 5 minutes the next game enters the start state.
The status listing contains the current maximum ER/EP/ED with submitter for each active ER, along with the current score and adjustment notes for each active player. The referee also keeps a count of ER and ER/EP/ED from all previous games. A rare ER has a count <= 5 and a rare ER/EP/ED has a count <= 2. Starting with game 132 more entries are excluded from the rarity count.
Under the Hood
The automaton and this documentation are configured by the following script:
- Code: Select all
# game configuration
typeset FORUM="Sudoku Players" # forum name
typeset TITLE="Patterns Game" # title
typeset RESULTS="Results" # final results topic
typeset VERSION=2.0 # version
typeset DAEMON=g.r.emlin # daemon id
typeset solver=g # gsf command line solver
typeset solver_name="gsf-solver" # solver name
typeset solver_version=2008-03-12 # oldest compatible solver version
typeset solver_url=http://www.research.att.com/~gsf/sudoku/ # solver url
typeset se=se # SE command line rater
typeset se_ED=-f%r/%p/%d # SE ER/EP/ED options
typeset SE_NAME="Sudoku Explainer" # SE name
typeset SE_VERSION=1.2.1 # oldest compatible SE version
typeset SE_URL=http://diuf.unifr.ch/people/juillera/Sudoku/Sudoku.html # SE url
typeset SE_RATE_URL=http://gsf.cococlyde.org/download/sudoku/SudokuExplainer.jar # SE rate url
typeset SE_RATE_MAN=http://gsf.cococlyde.org/download/sudoku/serate.html # SE rate man page
typeset RATING="ER/EP/ED" # rating label
typeset BONUSES=bonuses # submission bonus file
typeset CANDIDATES=candidates # candidate pattern file
typeset ENTRIES=entries # valid submission file
typeset PATTERNS=patterns # dealt pattern file
typeset PENALTIES=penalties # submission penalty file
typeset RATINGS=ratings # current ratings file
typeset SCORES=scores # current scores file
typeset CONTROL_PREFIX=::: # post control line prefix
typeset CONTROL_SUFFIX=::: # post control line suffix
typeset GENERATE=1000.100.60.30 # guesstimate solver -gtp N.R.F.S generation parameters
typeset HITS_MAX=20 # max hits for a "good pattern" in $GENERATE window
typeset AGENT_GENERATE=10000.100.60.30 # agent solver -gtp N.R.F.S generation parameters
typeset AGENT_HITS=10 # agent per-solver -n generation limit
typeset AGENT_NPROC=2 # agent new game active process id limit
typeset AGENT_REMOTE_NPROC=8 # agent new game remote search process limit
integer AGENT_SLEEP=1 # agent bedtime hour
integer AGENT_WAKE=9 # agent wake hour
integer AGENT_WAIT_SUBMIT=15*minutes # agent wait time before next move (beyond WAIT_SUBMIT)
integer AGENT_WAIT_OPPONENT=30*minutes # agent wait time after next opponent (randomized max)
typeset CONSTRAINTS="singles only" # must be solvable by these constraints
typeset CONSTRAINTS_EXPR=FN-G # solver -q solvable constraints
integer QUORUM=4 # minimum amount of players to enable idling
integer LIGHTNING=2 # lightning round frequency
integer CLUES_MIN=19 # minimum number of clues
integer CLUES_MAX=29 # maximum number of clues
integer SYMMETRY_MIN=2 # minimum dihedral symmetry order
integer SYMMETRY_MAX=8 # maximum dihedral symmetry order
integer IDLE_ENTRIES=3 # no idle until this many entries
float RATING_MIN=1.0 # minimum ER
float RATING_MAX=13.0 # maximum ER
typeset ISER="?(1)[0-9].[0-9]" # valid ER pattern
typeset ISED="$ISER/$ISER/$ISER" # valid ER/EP/ED pattern
integer RARE_ER=5 # rare ER count (of all previous games)
integer RARE_ED=2 # rare ER/EP/ED count (of all previous games)
# 0 for any SCORE_* value disables that bonus/penalty #
integer SCORE_CONSECUTIVE=-50 # consecutive entry adjustment
integer SCORE_DEAL=-20 # dealer adjustment
integer SCORE_ERROR=-50 # invalid/edited entry adjustment
integer SCORE_NOSE=-100 # invalid SE ER/EP/ED rating adjustment
integer SCORE_HIGHEST=0 # highest ER/EP/ED rating adjustment
integer SCORE_HIGHEST_PERCENT=10 # % of total at submission time for highest ER/EP/ED rating
integer SCORE_LAST=0 # last entry adjustment
integer SCORE_LAST_PERCENT=5 # % of total at submission time for last entry
integer SCORE_MORE=0 # ::: more ::: per entry adjustment
integer SCORE_PREMATURE=-50 # premature entry adjustment
integer SCORE_TIE=0 # tie entry adjustment
integer SCORE_RARE_ED=25 # rare ER/EP/ED rating bonus (maybe 0?)
integer SCORE_TRUMPED_RARE_ED=10 # trumped rare ER/EP/ED rating bonus (maybe 0?)
integer SCORE_SELF=-50 # self trump adjustment
typeset SCORE_PD="(5*(EP-2.3)+10*(ED-2.3))" # pearl/diamond bonus
integer ENTRY_STATUS=10 # status after this many entries
integer WAIT_CLOSED=2*hours # idle->closed transition interval
integer WAIT_IDLE=22*hours # open->idle transition interval
integer WAIT_IDLE_NOQUORUM=4*days # no quorum open->idle transition interval
integer WAIT_MAIL=2*hours # referee private message poll interval
integer WAIT_NEXT=10*minutes # next game poll interval
integer WAIT_OPEN=16*hours # start->open transition interval
integer WAIT_POLL=5*minutes # referee status poll interval
integer WAIT_POST=2*minute # time between forum posts
integer WAIT_ROUND=60*minutes # announced event time rounding
integer WAIT_START=2*days+16*hours # closed->start transition interval
integer WAIT_SUBMIT=10*minutes # minimum submission interval
integer WAIT_TIE=2*minutes # player tie entry window
# christmas holiday suspension #
g.r.emlin powered by ksh (and mm!)