Template talk:Sudoku 9x9 grid
Usage
[edit]{{templateName| align=side| table alignment. left & right flow text. defa:right title=title Text| table title, Defa: Sudoku 9x9 tstyle=title style| style body, used as style="tstyle;", defa:blank bgcolor=color| main background color, defa: fcfce8 bc=BoxBorderColor| major table grid and outer border color, defa:black bx=BoxBorderWidth| defa:1.5pt, displays as 2xWidth b1c=color|b2c...| background color for boxes 1..9, defa:bgcolor gc=GridColor| minor box grid color, defa:silver gx=GridWidth| defa:1.5pt cellsize=size| cell size, defa:12pt, min. for square cells s1..81...| cell (square) values, defa:blank, numbered left/right across the full top row, then down c1..81...| cell background color, defa: box bNc or bgcolor }}
Does: Displays a Sudoku Grid for supplied values.
Args: None required, all have default values.
See detail notes in template.
Call Tree
[edit]Implemented with multiple templates. Call tree order:
Template:Sudoku 9x9 grid top wrapper, set defa values Template:Sudoku 9x9 table table with 9 boxes, 81 cells, major grids, outer border]] Template:Sudoku 3x3 box 3x3 box 9 cells Template:Sudoku 3x3 table 3x3 table with 9 cells, int. grids only, no outer border
Examples
[edit]
|
|
| |||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||
|
|
|
Because the setup for calling the template can become large, an example is provided, which you can copy/paste/edit for actual use.
The example produces the puzzle show on the Sudoku main page, with some colors added to demonstrate color usage.
{{Sudoku 9x9 grid|align=left|title=Main Page Talk Example |s1=5|s2=3 |s5=7 |s10=6 |s13=1|s14=9|s15=5 |s20=9 |s21=8 |s26=6 |s28=8 |s32=6 |s36=3 |s37=4 |s40=8 |s42=3 |s45=1 |s46=7 |s50=2 |s54=6 |s56=6 |s61=2|s62=8 |s67=4|s68=1|s69=9 |s72=5 |s77=8 |s80=7|s81=9 |b1c=e8f0ff|b3c=e8f0ff|b5c=e0f0ff|b7c=d8f0ff|b9c=d8f0ff |c14=yellow|c20=fcfc80|c69=fcfc70|c81=fcfc50 }}
Sample parameter list
[edit]This is a complete list of cells with single digit values. When using this to create partial grids (puzzles), OMIT empty cells (see above). Specifying an empty value, e.g. |s37=|, can in some cases, cause display problems (disconnected subgrid edges).
|s1=1 |s2=2 |s3=3 |s4=4 |s5=5 |s6=6 |s7=7 |s8=8 |s9=9 |s10=1|s11=1|s12=1|s13=1|s14=1|s15=1|s16=1|s17=1|s18=1 |s19=9|s20=2|s21=2|s22=2|s23=2|s24=2|s25=2|s26=2|s27=2 |s28=8|s29=9|s30=3|s31=3|s32=3|s33=3|s34=3|s35=3|s36=3 |s37=7|s38=8|s39=9|s40=4|s41=4|s42=4|s43=4|s44=4|s45=4 |s46=5|s47=7|s48=4|s49=4|s50=5|s51=5|s52=5|s53=5|s54=5 |s55=5|s56=6|s57=5|s58=5|s59=5|s60=6|s61=6|s62=6|s63=6 |s64=4|s65=5|s66=6|s67=6|s68=6|s69=6|s70=7|s71=7|s72=7 |s73=3|s74=4|s75=7|s76=7|s77=7|s78=7|s79=7|s80=8|s81=8
Related Templates
[edit]Template:Sudoku 3x9 band
Template:Sudoku 3x9 table
Status
[edit]11/04/05 - minimally complete: works but not very useful yet. LarryLACa 10:32, 5 November 2005 (UTC)
11/06/05 - Add: bgcolor, cell color, cell size, align, title, title style Stable and working -- LarryLACa 08:28, 7 November 2005 (UTC)
11/7/05 Fix problems with border no show, convert to named input args, set default cell value to nbsp; trackdown edge color bleed through and margin disconnect problems. Convert from px to non-resolution dependent pt sizes. Optimize cell/font size for margin disconnect problem.
I think this is ready for initial usage. -- LarryLACa 09:99, 10 November 2005 (UTC)
Limitations & To Do
[edit]Add issues or bugs here, or in discussion below.
Cellsize Text size box margin disconnect
[edit]If the cell values in one box, make the box bigger other boxes in the same band or stack, the smaller boxes will have a (slight) margin where the minor inner grid does not connect with the major grid on the right/left or top/bottom respectivley.
Workaround: Increase the cellsize so all rows are of equal length. This deficiency normally only shows up when a minimal cellsize is used and cells contain demo values like 1..81, which makes box 1 smaller than the others. -- LarryLACa 08:28, 7 November 2005 (UTC)
Empty Cells
[edit]There was/is a related (margin disconnect) problem for the cellsize of empty vs set cells. This is minimized by (now) always having at least an nbsp value in blank cells (when called from 9x9 grid). The default cellsize was also set to typical font height, so the cells are relatively square. This will generally accomodate 2 chars/cell before varying box size causes a box margin disconnect. For wider contents cellsize may need to be increased to prevent disconnect. -- LarryLACa 07:13, 8 November 2005 (UTC)
When cells are empty, their margins don't display and the table background shows through. The impact is minized by setting the table bgcolor to the grid color (gc). This means, it's often OK to call the 9x9 table directly with a few numbered args, the other's being empty. Calling 3x3 table directly is not so easy, since the grid line parms are defined in 3x3 box. -- LarryLACa 21:21, 18 November 2005 (UTC)
To Do
[edit]Puzzle clue patterns
[edit]Add support for named pattern of puzzle clue cell colors
Alt paramenter naming conventions
[edit]Add alt templates for alt. naming conventions for cells: row-col, box-cell, etc.
3x3 Default parms
[edit]Add a template to display band 1.
Add default parameter values to the 3x3 templates.
-- LarryLACa 08:28, 7 November 2005 (UTC)
Band template created ~ 11/14. 3x3 defa parms relatively low priority.-- LarryLACa 21:05, 18 November 2005 (UTC)
Browser Compatability
[edit]Devoloped/tested only with IE 6 SP1 (under W98).
Marjor/Minor grid lines don't show with NS 4.78. Too old to be a major concern.
ToDo: Firefox, Opera...
General Discussion
[edit]Overly complicated
[edit]I strongly feel that this template is overly complicated and, to say the truth, plain ugly. Wikipedia needs an encyclopedic look. Templates where every parameter, such as all the colors, box sizes, grid widths and whatnots look different each time they are used look amateurish. Have you looked at the Template:Chess diagram? It's a perfect example of a game position template. For example, you don't need to name those squares like "s37=4", when you could just enter "4". I created an image-based sudoku at my sandbox, it could be easily turned into a template. What do you think? --ZeroOne 02:33, 27 December 2005 (UTC)
Doesn't Display Correctly
[edit]The template does not display properly in Opera 8.5.
It does not display properly in Firefox 1.5, either (I specifically have 1.5.0.1 on WinXP.) — CJewell (talk to me) 18:03, 25 February 2006 (UTC)