📄 solutions to the 8-queens problem.htm
字号:
<TD vAlign=center width="11%" bgColor=#000000><B><FONT color=#ffffff
size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="11%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="11%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="11%" bgColor=#000000>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="11%"><FONT size=2>
<P>0 </FONT></P></TD>
<TD vAlign=center width="11%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="11%" bgColor=#ffffff><B><FONT size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=top width="11%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="11%" bgColor=#ffffff>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="11%">
<P> </P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>0 </FONT></P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>1 </FONT></P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>2 </FONT></P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>3 </FONT></P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>4 </FONT></P></TD>
<TD vAlign=center width="11%"><FONT size=2>
<P>5 </FONT></P></TD>
<TD vAlign=top width="11%"><FONT size=2>
<P>6</FONT></P></TD>
<TD vAlign=top width="11%"><FONT size=2>
<P>7</FONT></P></TD></TR></TBODY></TABLE>
<P>For odd numbers, we can attach a queen at (n-1, n-1). </P>
<P>Example 4. n=9 </P>
<TABLE cellSpacing=0 width=256 border=0>
<TBODY>
<TR>
<TD vAlign=center width="10%">
<P><FONT size=2>7 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000><B><FONT color=#ffffff size=2>
<P align=center>X</B></FONT></P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>7 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff><B><FONT size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%">
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>6 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000><B><FONT color=#ffffff
size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>5 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000><B><FONT color=#ffffff
size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%">
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>4 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff><B><FONT size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>3 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff><B><FONT size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%">
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>2 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000><B><FONT color=#ffffff size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>1</FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000><B><FONT color=#ffffff
size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%">
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%"><FONT size=2>
<P>0 </FONT></P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=center width="10%" bgColor=#ffffff><B><FONT size=2>
<P align=center>X</B></FONT></P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#ffffff>
<P> </P></TD>
<TD vAlign=top width="10%" bgColor=#000000>
<P> </P></TD></TR>
<TR>
<TD vAlign=center width="10%">
<P> </P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>0 </FONT></P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>1 </FONT></P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>2 </FONT></P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>3 </FONT></P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>4 </FONT></P></TD>
<TD vAlign=center width="10%"><FONT size=2>
<P>5 </FONT></P></TD>
<TD vAlign=top width="10%"><FONT size=2>
<P>6</FONT></P></TD>
<TD vAlign=top width="20%" colSpan=2><FONT size=2>
<P>7</FONT></P></TD></TR></TBODY></TABLE>
<P>The eight queens problem is frequently used as an example in Artificial
Intelligence courses. The object is to place eight queens on an empty chess
board so that none of them can take the other. </P>
<P>
<HR>
<H2>Related Sites</H2>
<P>
<UL>
<LI><A href="http://www.st.rim.or.jp/~kanada/puzzles/queens.html">The Eight
Queens Page</A>
<LI>The <A href="http://www.scdi.org/~avernet/projects/jaskell/">Jaskell
Project Home Page</A> has a program and solution available for this problem.
</LI></UL>
<HR>
<P><FONT size=-1><A href="http://bridges.canterbury.ac.nz/index.html">Back to
the Bridges of Friendship Garden Homepage</A>
<P>Contact: <A href="http://www.cosc.canterbury.ac.nz/~tad/">Prof. Tadao
Takaoka</A>
<P><FONT size=1>Modified: 19-Nov-1998</FONT> </P></FONT></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -