Jeu Sudoku
dans Les-mathématiques
Bonjour,
Connaissez-vous le jeu Sudoku ?
En voici un exemple:
% \iffalse meta-comment
%
% sudoku.dtx
% Copyright 2005 Paul Abraham
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any
% later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% This Current Maintainer of this work is Paul Abraham.
%
% This work consists of the files sudoku.dtx, sudoku.ins
% README, CHANGES and the derived file sudoku.sty.
%
% \fi
%
% \iffalse
%\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%\ProvidesPackage{sudoku}
% [2005/06/29 v1.0 Sudoku grid]
%
%
%
% \fi
%
% \CheckSum{84}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \ Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \changes{v1.0}{2005/06/29}{Initial version}
%
% \GetFileInfo{sudoku.sty}
%
% \DoNotIndex{\newcommand,\newenvironment}
% \setlength{\parindent}{0pt}
% \setlength{\parskip}{5pt plus 2pt minus 1pt}
%
% \title{The \textsf{sudoku} package\thanks{This document
% corresponds to \textsf{sudoku}~\fileversion, dated \filedate.}}
% \author{Paul Abraham \\ \texttt{paul.abraham@hotpop.com}}
%
% \maketitle
%
% \section{Introduction}
%
% The \textsf{sudoku} package allows the user to typeset
% sudoku\footnote{I~have seen Sudoku written as Sudoku
% (one word) and Su Doku (two words). I don't know which of them (if
% either) is more correct than the other. I am just using one word.}
% puzzles.
%
% A~sudoku puzzle is a 9$\times$9 grid where some of the squares in
% the grid contain numbers. The rules are simple:
% every column can only contain the digits 1 to 9,
% every row can only contain the digits 1 to 9 and
% every 3$\times$3 box can only contain the digits 1 to 9.
%
% The puzzle derives its name from the Japanese \textit{Su}, meaning
% number, and \textit{Doku\/} meaning singular or solitary.
%
% More information, including help and example puzzles, can be found
% at \texttt{www.sudoku.org.uk}. This site also has blank sudoku grids
% (or worksheets), but you will not need to print them from there if
% you have this package installed.
%
% \section{Acknowledgements}
%
% I~want to thank Morten H\o gholm who took my first attempt at
% creating a sudoku environment in \LaTeX\ and corrected all my
% mistakes. He then gave me the help and encouragement to publish
% it as a package.
%
% \section{Usage}
%
% \DescribeMacro{\sudokuformat}
% This macro contains the formatting information for each number
% in the grid. The default value is \verb|\Huge\sffamily|, which
% gives correctly sized numbers for the default grid size, but it
% can be changed with \verb|\renewcommand*\sudokuformat[1]{\|\meta{font}|#1}|.
%
% \DescribeMacro{\sudokusize}
% This length contains the size of the grid, defaulting to \verb|10cm|.
% It can be changed with \verb|\setlength\sudokusize{|\meta{size}|}|.
%
% \DescribeEnv{sudoku-block}
% This environment draws the sudoku grid. The contents of each cell
% in the grid are delimited by the vertical bar (\verb+|+) character.
%
% \DescribeEnv{sudoku}
% This environment starts a |center| environment, then uses the
% |sudoku-block| environment to draw the grid.
%
% \section{Examples}
%
% This should be a relatively easy puzzle to solve.
%
% \begin{verbatim}
% \begin{sudoku}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku}
% \end{verbatim}
% The output is shown in figure~\ref{easypuzzle}. The solution is shown in
% figure~\ref{easysolution}.
%
% \begin{figure}[t]
% \begin{sudoku}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku}
% \caption{Easy puzzle\label{easypuzzle}}
% \end{figure}
%
% This is a bit more difficult.
%
% \begin{verbatim}
% \begin{sudoku}
% | |2| | |3| |9| |7|.
% | |1| | | | | | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | |9| |.
% | | | |1|8| |7| | |.
% | |4| | | |3| | | |.
% | | | | |6| | |7|1|.
% | |7| | | | | | | |.
% |9| |3| |2| |6| |5|.
% \end{sudoku}
% \end{verbatim}
% The output is shown in figure~\ref{difficultpuzzle}. The solution is shown in
% figure~\ref{difficultsolution}.
%
% \begin{figure}[t]
% \begin{sudoku}
% | |2| | |3| |9| |7|.
% | |1| | | | | | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | |9| |.
% | | | |1|8| |7| | |.
% | |4| | | |3| | | |.
% | | | | |6| | |7|1|.
% | |7| | | | | | | |.
% |9| |3| |2| |6| |5|.
% \end{sudoku}
% \caption{Difficult puzzle\label{difficultpuzzle}}
% \end{figure}
%
% \newpage
% This code will create the same grid inline:
% \begin{verbatim}
% \renewcommand*\sudokuformat[1]{\sffamily#1}
% \setlength\sudokusize{5cm}
% Easy Sudoku Puzzle
% \begin{sudoku-block}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku-block}
% \end{verbatim}
%
% \StopEventually{}
%
%\iffalse
% 2005/06/29 v1.0 Initial version
%\fi
%
% \section{Implementation}
%
% First initialise a couple of counters that keep track of where we are.
% \begin{macrocode}
\newcounter{@sudoku@row}
\newcounter{@sudoku@col}
% \end{macrocode}
%
% \begin{macrocode}
\newcommand*\@sudoku@separator[1]{%
\stepcounter{@sudoku@col}%
\ifx#1\@sudoku@separator
\expandafter#1%
\else
\ifx.#1%
\setcounter{@sudoku@col}{-1}%
\addtocounter{@sudoku@row}{-1}%
\else
\put(\value{@sudoku@col},\value{@sudoku@row})%
{\makebox(1,1){\sudokuformat{#1}}}%
\fi
\fi
}
% \end{macrocode}
%
% \begin{macrocode}
\begingroup
\catcode`\|=\active
\gdef\@sudoku@activate{\let|=\@sudoku@separator}
\endgroup
% \end{macrocode}
%
% Now we can draw the grid. Each 3$\times$3 box has thicker borders
% than the rest of the grid.
%
% \begin{macrocode}
\newcommand*\@sudoku@grid{%
\thinlines
\multiput(0,0)(1,0){10}{\line(0,1){9}}%
\multiput(0,0)(0,1){10}{\line(1,0){9}}
\thicklines
\multiput(0,0)(3,0){4}{\line(0,1){9}}%
\multiput(0,0)(0,3){4}{\line(1,0){9}}
}
% \end{macrocode}
%
% The default font is a huge, sans serif font.
% \begin{macrocode}
\newcommand*\sudokuformat[1]{\Huge\sffamily#1}
% \end{macrocode}
%
% The grid defaults to a 10 centimetre square.
% \begin{macrocode}
\newdimen\sudokusize
\setlength\sudokusize{10cm}
% \end{macrocode}
%
% Make the size of each square $1/9$ of the size of sudoku grid.
% \begin{macrocode}
\newenvironment{sudoku-block}{%
\catcode`\|=\active
\@sudoku@activate
\setcounter{@sudoku@col}{-1}%
\setcounter{@sudoku@row}{8}%
\setlength\unitlength{.111111\sudokusize}%
\begin{picture}(9,9)%
\@sudoku@grid\@sudoku@grab@arguments
}{\end{picture}}
% \end{macrocode}
%
% As we change the \verb|catcode| of \verb+|+ inside the environment,
% under normal \TeX\ we can't just use such an environment as an argument
% of another command. This can be solved by using e\TeX\ as engine for
% \LaTeX, which is what all the major distributions do currently.
% \begin{macrocode}
\begingroup
\@ifundefined{eTeXversion}{\endgroup
\def\@sudoku@grab@arguments#1{%
\ifx#1\@sudoku@separator
\expandafter#1%
\else
\PackageError{sudoku}{%
Sudoku puzzles are not allowed in the arguments\MessageBreak
of other commands}{%
Either fix this in your source (possibly using the `lrbox'
environment) or use an eTeX based LaTeX format}
\fi
}%
}{\endgroup
\def\@sudoku@grab@arguments#1.#2.#3.#4.#5.#6.#7.#8.#9.{%
\scantokens{#1.#2.#3.#4.#5.#6.#7.#8.#9.}}%
}
% \end{macrocode}
%
% The |sudoku| environment simply calls the |sudoku-block|
% environment inside a |center| environment.
% \begin{macrocode}
\newenvironment{sudoku}{%
\begin{center}%
\begin{sudoku-block}}{\end{sudoku-block}\end{center}}
% \end{macrocode}
%
% \Finale
%
% \begin{figure}
% \begin{sudoku}
% |2|5|8|7|3|6|9|4|1|.
% |6|1|9|8|2|4|3|5|7|.
% |4|3|7|9|1|5|2|6|8|.
% |3|9|5|2|7|1|4|8|6|.
% |7|6|2|4|9|8|1|3|5|.
% |8|4|1|6|5|3|7|2|9|.
% |1|8|4|3|6|9|5|7|2|.
% |5|7|6|1|4|2|8|9|3|.
% |9|2|3|5|8|7|6|1|4|.
% \end{sudoku}
% \caption{Solution for easy puzzle\label{easysolution}}
% \end{figure}
%
% \begin{figure}
% \begin{sudoku}
% |6|2|8|5|3|4|9|1|7|.
% |5|1|9|8|7|2|4|3|6|.
% |4|3|7|9|1|6|2|5|8|.
% |8|6|5|2|4|7|1|9|3|.
% |3|9|2|1|8|5|7|6|4|.
% |7|4|1|6|9|3|5|8|2|.
% |2|5|4|3|6|9|8|7|1|.
% |1|7|6|4|5|8|3|2|9|.
% |9|8|3|7|2|1|6|4|5|.
% \end{sudoku}
% \caption{Solution for difficult puzzle\label{difficultsolution}}
% \end{figure}
%
\endinput
\begin{texttt}
| |4|2| |3| | | | |.
| | |5| | | | | | |.
| | | |9| | | | |8|.
|1| | |8| | | | | |.
| | |3| |4| |2| | |.
| | | | | |7| | |6|.
|7| | | | |6| | | |.
| | | | | | |4|6| |.
| | | |2| | |5|9| |.
\end{texttt}
Il faut simplement remplir les cases manquantes de façon à avoir les chiffres 1 à 9 dans chaque ligne, chaque colonne et chaque carré.
Pour plus d'informations, regardez sur www.sudoku.com
--
Tony
Connaissez-vous le jeu Sudoku ?
En voici un exemple:
% \iffalse meta-comment
%
% sudoku.dtx
% Copyright 2005 Paul Abraham
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any
% later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% This Current Maintainer of this work is Paul Abraham.
%
% This work consists of the files sudoku.dtx, sudoku.ins
% README, CHANGES and the derived file sudoku.sty.
%
% \fi
%
% \iffalse
%\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%\ProvidesPackage{sudoku}
% [2005/06/29 v1.0 Sudoku grid]
%
%
%
% \fi
%
% \CheckSum{84}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \ Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \changes{v1.0}{2005/06/29}{Initial version}
%
% \GetFileInfo{sudoku.sty}
%
% \DoNotIndex{\newcommand,\newenvironment}
% \setlength{\parindent}{0pt}
% \setlength{\parskip}{5pt plus 2pt minus 1pt}
%
% \title{The \textsf{sudoku} package\thanks{This document
% corresponds to \textsf{sudoku}~\fileversion, dated \filedate.}}
% \author{Paul Abraham \\ \texttt{paul.abraham@hotpop.com}}
%
% \maketitle
%
% \section{Introduction}
%
% The \textsf{sudoku} package allows the user to typeset
% sudoku\footnote{I~have seen Sudoku written as Sudoku
% (one word) and Su Doku (two words). I don't know which of them (if
% either) is more correct than the other. I am just using one word.}
% puzzles.
%
% A~sudoku puzzle is a 9$\times$9 grid where some of the squares in
% the grid contain numbers. The rules are simple:
% every column can only contain the digits 1 to 9,
% every row can only contain the digits 1 to 9 and
% every 3$\times$3 box can only contain the digits 1 to 9.
%
% The puzzle derives its name from the Japanese \textit{Su}, meaning
% number, and \textit{Doku\/} meaning singular or solitary.
%
% More information, including help and example puzzles, can be found
% at \texttt{www.sudoku.org.uk}. This site also has blank sudoku grids
% (or worksheets), but you will not need to print them from there if
% you have this package installed.
%
% \section{Acknowledgements}
%
% I~want to thank Morten H\o gholm who took my first attempt at
% creating a sudoku environment in \LaTeX\ and corrected all my
% mistakes. He then gave me the help and encouragement to publish
% it as a package.
%
% \section{Usage}
%
% \DescribeMacro{\sudokuformat}
% This macro contains the formatting information for each number
% in the grid. The default value is \verb|\Huge\sffamily|, which
% gives correctly sized numbers for the default grid size, but it
% can be changed with \verb|\renewcommand*\sudokuformat[1]{\|\meta{font}|#1}|.
%
% \DescribeMacro{\sudokusize}
% This length contains the size of the grid, defaulting to \verb|10cm|.
% It can be changed with \verb|\setlength\sudokusize{|\meta{size}|}|.
%
% \DescribeEnv{sudoku-block}
% This environment draws the sudoku grid. The contents of each cell
% in the grid are delimited by the vertical bar (\verb+|+) character.
%
% \DescribeEnv{sudoku}
% This environment starts a |center| environment, then uses the
% |sudoku-block| environment to draw the grid.
%
% \section{Examples}
%
% This should be a relatively easy puzzle to solve.
%
% \begin{verbatim}
% \begin{sudoku}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku}
% \end{verbatim}
% The output is shown in figure~\ref{easypuzzle}. The solution is shown in
% figure~\ref{easysolution}.
%
% \begin{figure}[t]
% \begin{sudoku}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku}
% \caption{Easy puzzle\label{easypuzzle}}
% \end{figure}
%
% This is a bit more difficult.
%
% \begin{verbatim}
% \begin{sudoku}
% | |2| | |3| |9| |7|.
% | |1| | | | | | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | |9| |.
% | | | |1|8| |7| | |.
% | |4| | | |3| | | |.
% | | | | |6| | |7|1|.
% | |7| | | | | | | |.
% |9| |3| |2| |6| |5|.
% \end{sudoku}
% \end{verbatim}
% The output is shown in figure~\ref{difficultpuzzle}. The solution is shown in
% figure~\ref{difficultsolution}.
%
% \begin{figure}[t]
% \begin{sudoku}
% | |2| | |3| |9| |7|.
% | |1| | | | | | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | |9| |.
% | | | |1|8| |7| | |.
% | |4| | | |3| | | |.
% | | | | |6| | |7|1|.
% | |7| | | | | | | |.
% |9| |3| |2| |6| |5|.
% \end{sudoku}
% \caption{Difficult puzzle\label{difficultpuzzle}}
% \end{figure}
%
% \newpage
% This code will create the same grid inline:
% \begin{verbatim}
% \renewcommand*\sudokuformat[1]{\sffamily#1}
% \setlength\sudokusize{5cm}
% Easy Sudoku Puzzle
% \begin{sudoku-block}
% |2|5| | |3| |9| |1|.
% | |1| | | |4| | | |.
% |4| |7| | | |2| |8|.
% | | |5|2| | | | | |.
% | | | | |9|8|1| | |.
% | |4| | | |3| | | |.
% | | | |3|6| | |7|2|.
% | |7| | | | | | |3|.
% |9| |3| | | |6| |4|.
% \end{sudoku-block}
% \end{verbatim}
%
% \StopEventually{}
%
%\iffalse
% 2005/06/29 v1.0 Initial version
%\fi
%
% \section{Implementation}
%
% First initialise a couple of counters that keep track of where we are.
% \begin{macrocode}
\newcounter{@sudoku@row}
\newcounter{@sudoku@col}
% \end{macrocode}
%
% \begin{macrocode}
\newcommand*\@sudoku@separator[1]{%
\stepcounter{@sudoku@col}%
\ifx#1\@sudoku@separator
\expandafter#1%
\else
\ifx.#1%
\setcounter{@sudoku@col}{-1}%
\addtocounter{@sudoku@row}{-1}%
\else
\put(\value{@sudoku@col},\value{@sudoku@row})%
{\makebox(1,1){\sudokuformat{#1}}}%
\fi
\fi
}
% \end{macrocode}
%
% \begin{macrocode}
\begingroup
\catcode`\|=\active
\gdef\@sudoku@activate{\let|=\@sudoku@separator}
\endgroup
% \end{macrocode}
%
% Now we can draw the grid. Each 3$\times$3 box has thicker borders
% than the rest of the grid.
%
% \begin{macrocode}
\newcommand*\@sudoku@grid{%
\thinlines
\multiput(0,0)(1,0){10}{\line(0,1){9}}%
\multiput(0,0)(0,1){10}{\line(1,0){9}}
\thicklines
\multiput(0,0)(3,0){4}{\line(0,1){9}}%
\multiput(0,0)(0,3){4}{\line(1,0){9}}
}
% \end{macrocode}
%
% The default font is a huge, sans serif font.
% \begin{macrocode}
\newcommand*\sudokuformat[1]{\Huge\sffamily#1}
% \end{macrocode}
%
% The grid defaults to a 10 centimetre square.
% \begin{macrocode}
\newdimen\sudokusize
\setlength\sudokusize{10cm}
% \end{macrocode}
%
% Make the size of each square $1/9$ of the size of sudoku grid.
% \begin{macrocode}
\newenvironment{sudoku-block}{%
\catcode`\|=\active
\@sudoku@activate
\setcounter{@sudoku@col}{-1}%
\setcounter{@sudoku@row}{8}%
\setlength\unitlength{.111111\sudokusize}%
\begin{picture}(9,9)%
\@sudoku@grid\@sudoku@grab@arguments
}{\end{picture}}
% \end{macrocode}
%
% As we change the \verb|catcode| of \verb+|+ inside the environment,
% under normal \TeX\ we can't just use such an environment as an argument
% of another command. This can be solved by using e\TeX\ as engine for
% \LaTeX, which is what all the major distributions do currently.
% \begin{macrocode}
\begingroup
\@ifundefined{eTeXversion}{\endgroup
\def\@sudoku@grab@arguments#1{%
\ifx#1\@sudoku@separator
\expandafter#1%
\else
\PackageError{sudoku}{%
Sudoku puzzles are not allowed in the arguments\MessageBreak
of other commands}{%
Either fix this in your source (possibly using the `lrbox'
environment) or use an eTeX based LaTeX format}
\fi
}%
}{\endgroup
\def\@sudoku@grab@arguments#1.#2.#3.#4.#5.#6.#7.#8.#9.{%
\scantokens{#1.#2.#3.#4.#5.#6.#7.#8.#9.}}%
}
% \end{macrocode}
%
% The |sudoku| environment simply calls the |sudoku-block|
% environment inside a |center| environment.
% \begin{macrocode}
\newenvironment{sudoku}{%
\begin{center}%
\begin{sudoku-block}}{\end{sudoku-block}\end{center}}
% \end{macrocode}
%
% \Finale
%
% \begin{figure}
% \begin{sudoku}
% |2|5|8|7|3|6|9|4|1|.
% |6|1|9|8|2|4|3|5|7|.
% |4|3|7|9|1|5|2|6|8|.
% |3|9|5|2|7|1|4|8|6|.
% |7|6|2|4|9|8|1|3|5|.
% |8|4|1|6|5|3|7|2|9|.
% |1|8|4|3|6|9|5|7|2|.
% |5|7|6|1|4|2|8|9|3|.
% |9|2|3|5|8|7|6|1|4|.
% \end{sudoku}
% \caption{Solution for easy puzzle\label{easysolution}}
% \end{figure}
%
% \begin{figure}
% \begin{sudoku}
% |6|2|8|5|3|4|9|1|7|.
% |5|1|9|8|7|2|4|3|6|.
% |4|3|7|9|1|6|2|5|8|.
% |8|6|5|2|4|7|1|9|3|.
% |3|9|2|1|8|5|7|6|4|.
% |7|4|1|6|9|3|5|8|2|.
% |2|5|4|3|6|9|8|7|1|.
% |1|7|6|4|5|8|3|2|9|.
% |9|8|3|7|2|1|6|4|5|.
% \end{sudoku}
% \caption{Solution for difficult puzzle\label{difficultsolution}}
% \end{figure}
%
\endinput
\begin{texttt}
| |4|2| |3| | | | |.
| | |5| | | | | | |.
| | | |9| | | | |8|.
|1| | |8| | | | | |.
| | |3| |4| |2| | |.
| | | | | |7| | |6|.
|7| | | | |6| | | |.
| | | | | | |4|6| |.
| | | |2| | |5|9| |.
\end{texttt}
Il faut simplement remplir les cases manquantes de façon à avoir les chiffres 1 à 9 dans chaque ligne, chaque colonne et chaque carré.
Pour plus d'informations, regardez sur www.sudoku.com
--
Tony
Connectez-vous ou Inscrivez-vous pour répondre.
Réponses
\newline .42|.3.|...
\newline ..5|...|...
\newline ...|9..|..8
\newline
\newline 1..|8..|...
\newline ..3|.4.|2..
\newline ...|..7|..6
\newline
\newline 7..|..6|...
\newline ...|...|46.
\newline ...|.2.|59.
\newline</PRE>
<BR>
<BR>Il faut simplement remplir les cases manquantes de façon à avoir les chiffres 1 à 9 dans chaque ligne, chaque colonne et chaque carré.
<BR>
<BR>www.sudoku.com
<BR>
<BR>-
<BR>Tony<BR>
Domi
J'ai rencontré mon premier sudoku il y a deux semaines dans un quotidien roumain, et je dois dire que je me suis bien amusé avant d'en venir à bout (45 minutes !)
Je ne me suis pas encore essayé à ce jeu, par conséquent peut-être que la réponse est évidente quand on a quelques rudiments.
27 équations du type Somme x_ij =45 avec les x_ij dans {1,2,...9} dont certaines solutions x_ij sont données etc.....
Michiel
Domi
En Excel c'est encore mieux.
Michiel
Voici un solveur de sudoku que j'ai écrit en Maple avec quelques exemples, et qui doit donc aider ce qui bloquent.
Bon amusement...
(pièce jointe en fichier texte)
Voici un lien d'ou l'on peut telecharger une feuille 'excel' qui permet de resoudre ces 'sudoku'.
<http://www.di-mgt.com.au/sudoku.html>
<http://www.shef.ac.uk/~pm1afj/sudoku/sudgroup.html>
@+
Saurait-on déjà y répondre sur un "DEUX-SUDOKU", je veux dire par là une grille de 16 nombres divisés en quatre carrés de quatre cases (et avec donc 12 contraintes ; 4 de lignes, 4 de colonnes et 4 pour les carrés)
B.
3<=S<=8
Minoration. si vous vous donnez deux lettres (je préfère lettre que chiffre car c'est purement combinatoire) au maximum, vous pouvez toujours permuter les deux lettres non utilisées et vous n'aurez pas unicité. Donc S>=3
Majoration. Vous donnez un carré de lettres 3-3 sauf la case centrale, soit huit lettres (disons celui en haut à gauche pour fixer les idées). Alors le carré 2-2 a déjà trois lettres données, et est déterminé. Puis on remplit les lignes et les colonnes. Donc S<=8
B.
En effet, il est facile de construite un 2-Sud. tel que quand vous connaissez les toutes les lettres sauf les 4 du carré en bas à droite, il est entierement déterminé.
Je considère ce 2-Sud. là, dont je donne les sept lettres qui sont dans le carré 3-3 en haut à droite, sauf la case centrale et la case en bas à droite. Alors comme tout a l'heure, on connait deja trois lettres du carré 2-2 en haut à droite, d'ou la quatrieme.
Puis par le jeu des lignes et colonnes, on determine toutes les lettres sauf celles du carré en bas à droite
hop
Ci-dessous un 2-Sudoku avec 5 données initiales, et une unique solution.
"(2,1) = c" signifie que dans la case de coordonnées (2,1) je mets la lettre "c"
(2,1) = c
(4,1) = a
(3,2) = d
(2,4) = b
(3,4) = c
hiphop
J'ai vu sur un site ce sudoku à solution unique avec 17 cases données initialement:
0 0 0 0 0 0 0 1 2
0 0 0 0 3 5 0 0 0
0 0 0 6 0 0 0 7 0
7 0 0 0 0 0 3 0 0
0 0 0 4 0 0 8 0 0
1 0 0 0 0 0 0 0 0
0 0 0 1 2 0 0 0 0
0 8 0 0 0 0 0 4 0
0 5 0 0 0 0 6 0 0
Peut-on descendre ce nombre de 17?
Autre question délicate:
Si l'on désire programmer un générateur de n-Sudoku, ou ce qui revient au même créer une grille n²xn² de sudoku, par quel algorithme choisir les données initiales afin d'être sur que le problème n'admette qu'une solution unique?
bob