Difference between revisions of "Template:Sudoku"

From Organic Design wiki
m
(doh wikipedia already have a sudoku template)
 
Line 1: Line 1:
<table style="border:5px solid black"><tr>
+
<!-- Sudoku grid display
<td>{{sudoku-region|{{{1}}}|{{{2}}}|{{{3}}}|{{{10}}}|{{{11}}}|{{{12}}}|{{{19}}}|{{{20}}}|{{{21}}}}}</td>
+
Usage:
<td>{{sudoku-region|{{{4}}}|{{{5}}}|{{{6}}}|{{{13}}}|{{{14}}}|{{{15}}}|{{{22}}}|{{{23}}}|{{{24}}}}}</td>
+
{{templateName|
<td>{{sudoku-region|{{{7}}}|{{{8}}}|{{{9}}}|{{{16}}}|{{{17}}}|{{{18}}}|{{{25}}}|{{{26}}}|{{{27}}}}}</td>
+
  align=side            table alignment. left & right flow text. Defa:right
</tr><tr>
+
  title=title Text      table title, Defa: Sudoku 9x9
<td>{{sudoku-region|{{{28}}}|{{{29}}}|{{{30}}}|{{{37}}}|{{{38}}}|{{{39}}}|{{{46}}}|{{{47}}}|{{{48}}}}}</td>
+
  tstyle=title style    title style body, for style="tstyle", Defa: blank
<td>{{sudoku-region|{{{31}}}|{{{32}}}|{{{33}}}|{{{40}}}|{{{41}}}|{{{42}}}|{{{49}}}|{{{20}}}|{{{51}}}}}</td>
+
  bgcolor=color|        main background color, defa: fcfcc8
<td>{{sudoku-region|{{{34}}}|{{{35}}}|{{{36}}}|{{{43}}}|{{{44}}}|{{{45}}}|{{{52}}}|{{{53}}}|{{{54}}}}}</td>
+
  bc=BoxBorderColor|    major table grid and outer border
</tr><tr>
+
  bx=BoxBorderWidth|    defa: 1.5pt, displays as 2xWidth
<td>{{sudoku-region|{{{55}}}|{{{56}}}|{{{57}}}|{{{64}}}|{{{65}}}|{{{66}}}|{{{71}}}|{{{74}}}|{{{75}}}}}</td>
+
  b1c=color|b2c...|    background color for boxes 1..9, defa=bgcolor
<td>{{sudoku-region|{{{58}}}|{{{59}}}|{{{60}}}|{{{67}}}|{{{68}}}|{{{69}}}|{{{76}}}|{{{77}}}|{{{78}}}}}</td>
+
  gc=GridColor|        minor box grid, defa: silver
<td>{{sudoku-region|{{{61}}}|{{{62}}}|{{{63}}}|{{{70}}}|{{{71}}}|{{{72}}}|{{{79}}}|{{{80}}}|{{{81}}}}}</td>
+
  gx=GridWidth|        defa: 1.5pt
</tr></table>
+
  cellsize=size|        cell size, defa: 30pt, the min. for square cells
 +
  s1..s81|              81 cell square values, defa: blank
 +
  c1..81...|            cell background color, defa: bNc or bgcolor
 +
}}
 +
 
 +
Does: Displays a Sudoku Grid, with supplied values.
 +
 
 +
Args: None required, all have default values.
 +
 
 +
Template Call Tree        does and calls next
 +
Sudoku 9x9 grid          top wrapper, set defa values
 +
Sudoku 9x9 table          table with 9 boxes, 81 cells, major grids, outer border
 +
Sudoku 3x3 box            3x3 box 9 cells
 +
Sudoku 3x3 table          3x3 table with 9 cells, int. grids only, no outer border
 +
 
 +
Implementation Notes: (yes I am a compulsive newbie..}
 +
|tparm={{{parm}}}|      parameter assignments must have a default value
 +
  otherwise the target tparm gets the literal text "{{{parm}}}"
 +
  when parm is undefined.  I.e.
 +
  There is no way to pass on a param and have it be undefined
 +
  in the called template.
 +
  {{{parm|}}} is sufficient and creates an empty param,
 +
  which is not detected by subsequent {{{parm|}}} test as undef.
 +
It's not possible to pass (in) an undefined numbered arg.
 +
  || passes a defined, but empty value, which cannot be detected and
 +
  translated to a blank value.
 +
The cell values cannot be empty, else the cell grid borders don't show.
 +
  Use &nbsp; as default.
 +
 
 +
See [[Template:Sudoku 9x9 table]] and
 +
    [[Template:Sudoku 3x3 table]] for table trivia
 +
Modeled after [[Template:4x4 type square]]
 +
Orig: LarryLACa 11/4/05
 +
 
 +
This comment must cuddle next template call to avoid introducing nl whitespace in output,
 +
-->{{Sudoku 9x9 table|=
 +
|{{{s1|&nbsp;}}}|{{{s2|&nbsp;}}}|{{{s3|&nbsp;}}}|{{{s4|&nbsp;}}}|{{{s5|&nbsp;}}}|=
 +
|{{{s6|&nbsp;}}}|{{{s7|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bsp;}}}|{{{s67|&nbsp;}}}|{{{s68|&nbsp;}}}|=
 +
|{{{s69|&nbsp;}}}|{{{s70|&nbsp;}}}|{{{s71|&nbsp;}}}|{{{s72|&nbsp;}}}|=
 +
|{{{s73|&nbsp;}}}|{{{s74|&nbsp;}}}|{{{s75|&nbsp;}}}|{{{s76|&nbsp;}}}|{{{s77|&nbsp;}}}|=
 +
|{{{s78|&nbsp;}}}|{{{s79|&nbsp;}}}|{{{s80|&nbsp;}}}|{{{s81|&nbsp;}}}|=
 +
|c1={{{c1|}}}|c2={{{c2|}}}|c3={{{c3|}}}|c4={{{c4|}}}|c5={{{c5|}}}|c6={{{c6|}}}|c7={{{c7|}}}|c8={{{c8|}}}|c9={{{c9|}}}|=
 +
|c10={{{c10|}}}|c11={{{c11|}}}|c12={{{c12|}}}|c13={{{c13|}}}|c14={{{c14|}}}|c15={{{c15|}}}|c16={{{c16|}}}|c17={{{c17|}}}|c18={{{c18|}}}|=
 +
|c19={{{c19|}}}|c20={{{c20|}}}|c21={{{c21|}}}|c22={{{c22|}}}|c23={{{c23|}}}|c24={{{c24|}}}|c25={{{c25|}}}|c26={{{c26|}}}|c27={{{c27|}}}|=
 +
|c28={{{c28|}}}|c29={{{c29|}}}|c30={{{c30|}}}|c31={{{c31|}}}|c32={{{c32|}}}|c33={{{c33|}}}|c34={{{c34|}}}|c35={{{c35|}}}|c36={{{c36|}}}|=
 +
|c37={{{c37|}}}|c38={{{c38|}}}|c39={{{c39|}}}|c40={{{c40|}}}|c41={{{c41|}}}|c42={{{c42|}}}|c43={{{c43|}}}|c44={{{c44|}}}|c45={{{c45|}}}|=
 +
|c46={{{c46|}}}|c47={{{c47|}}}|c48={{{c48|}}}|c49={{{c49|}}}|c50={{{c50|}}}|c51={{{c51|}}}|c52={{{c52|}}}|c53={{{c53|}}}|c54={{{c54|}}}|=
 +
|c55={{{c55|}}}|c56={{{c56|}}}|c57={{{c57|}}}|c58={{{c58|}}}|c59={{{c59|}}}|c60={{{c60|}}}|c61={{{c61|}}}|c62={{{c62|}}}|c63={{{c63|}}}|=
 +
|c64={{{c64|}}}|c65={{{c65|}}}|c66={{{c66|}}}|c67={{{c67|}}}|c68={{{c68|}}}|c69={{{c69|}}}|c70={{{c70|}}}|c71={{{c71|}}}|c72={{{c72|}}}|=
 +
|c73={{{c73|}}}|c74={{{c74|}}}|c75={{{c75|}}}|c76={{{c76|}}}|c77={{{c77|}}}|c78={{{c78|}}}|c79={{{c79|}}}|c80={{{c80|}}}|c81={{{c81|}}}|=
 +
|bc={{{bc|black}}}|bx={{{bx|1.5pt}}}|gc={{{gc|silver}}}|gx={{{gx|1.5pt}}}|=
 +
|bgcolor={{{bgcolor|fcfcc8}}}|cellsize={{{cellsize|12pt}}}|=
 +
|align={{{align|right}}}|title={{{title|Sudoku 9x9}}}|tstyle={{{tstyle|}}}|=
 +
|b1c={{{b1c|}}}|b2c={{{b2c|}}}|b3c={{{b3c|}}}|b4c={{{b4c|}}}|b5c={{{b5c|}}}|=
 +
|b6c={{{b6c|}}}|b7c={{{b7c|}}}|b8c={{{b8c|}}}|b9c={{{b9c|}}}|=
 +
}}<noinclude>[[id:Template:Sudoku 9x9 grid]]</noinclude>

Latest revision as of 07:10, 13 August 2007

Sudoku 9x9
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

id:Template:Sudoku 9x9 grid