solver-0h-h1/sources/solver_0hh1.html

311 lines
19 KiB
HTML
Raw Permalink Normal View History

2015-03-24 11:05:01 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module solver_0hh1</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>solver_0hh1</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/gaugendre/Projects/python/0hh1-solver/sources/solver_0hh1.py">/home/gaugendre/Projects/python/0hh1-solver/sources/solver_0hh1.py</a></font></td></tr></table>
<p><tt>#&nbsp;0h&nbsp;h1&nbsp;Solver.&nbsp;Solves&nbsp;grids&nbsp;of&nbsp;0h&nbsp;h1&nbsp;game.<br>
#&nbsp;Copyright&nbsp;(C)&nbsp;2015&nbsp;&nbsp;Gabriel&nbsp;Augendre&nbsp;&lt;gabriel@augendre.info&gt;<br>
#<br>
#&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software:&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and/or&nbsp;modify<br>
#&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;as&nbsp;published&nbsp;by<br>
#&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation,&nbsp;either&nbsp;version&nbsp;3&nbsp;of&nbsp;the&nbsp;License,&nbsp;or<br>
#&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.<br>
#<br>
#&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,<br>
#&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of<br>
#&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the<br>
#&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.<br>
#<br>
#&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License<br>
#&nbsp;along&nbsp;with&nbsp;this&nbsp;program.&nbsp;&nbsp;If&nbsp;not,&nbsp;see&nbsp;&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="solver_0hh1.html#Grid">Grid</a>
</font></dt><dt><font face="helvetica, arial"><a href="solver_0hh1.html#Square">Square</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Grid">class <strong>Grid</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;<a href="#Grid">Grid</a>&nbsp;is&nbsp;a&nbsp;square&nbsp;array&nbsp;containing&nbsp;Squares.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Grid-__init__"><strong>__init__</strong></a>(self, size, array=None)</dt><dd><tt>Instantiate&nbsp;a&nbsp;grid&nbsp;from&nbsp;a&nbsp;size&nbsp;and&nbsp;maybe&nbsp;an&nbsp;array&nbsp;of&nbsp;characters.<br>
If&nbsp;an&nbsp;array&nbsp;is&nbsp;provided,&nbsp;the&nbsp;grid&nbsp;will&nbsp;be&nbsp;filled&nbsp;with&nbsp;squares<br>
with&nbsp;state&nbsp;corresponding&nbsp;to&nbsp;the&nbsp;character&nbsp;in&nbsp;the&nbsp;array.<br>
:param&nbsp;size:&nbsp;The&nbsp;size&nbsp;of&nbsp;the&nbsp;grid&nbsp;(either&nbsp;width&nbsp;or&nbsp;length).<br>
:type&nbsp;size:&nbsp;int<br>
:param&nbsp;array:&nbsp;The&nbsp;array&nbsp;used&nbsp;to&nbsp;fill&nbsp;the&nbsp;grid.<br>
:type&nbsp;array:&nbsp;list</tt></dd></dl>
<dl><dt><a name="Grid-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>
<dl><dt><a name="Grid-solve"><strong>solve</strong></a>(self)</dt><dd><tt>Solves&nbsp;the&nbsp;grid&nbsp;using&nbsp;'three&nbsp;in&nbsp;a&nbsp;row',&nbsp;'same&nbsp;number&nbsp;of&nbsp;red&nbsp;and&nbsp;blue<br>
on&nbsp;the&nbsp;same&nbsp;line&nbsp;or&nbsp;column'&nbsp;and,&nbsp;later,&nbsp;'no&nbsp;identical&nbsp;line&nbsp;or&nbsp;column'.</tt></dd></dl>
<dl><dt><a name="Grid-solve_different_lines_or_columns"><strong>solve_different_lines_or_columns</strong></a>(self)</dt><dd><tt>Solves&nbsp;the&nbsp;grid&nbsp;implementing&nbsp;the&nbsp;fact&nbsp;that&nbsp;there&nbsp;isn't&nbsp;two&nbsp;identical<br>
lines&nbsp;or&nbsp;columns.<br>
&nbsp;<br>
:return:&nbsp;True&nbsp;if&nbsp;a&nbsp;square&nbsp;has&nbsp;been&nbsp;modified,&nbsp;else&nbsp;False.<br>
:rtype:&nbsp;bool<br>
&nbsp;<br>
..&nbsp;warning::&nbsp;Function&nbsp;still&nbsp;not&nbsp;finished.&nbsp;DOESN'T&nbsp;WORK.</tt></dd></dl>
<dl><dt><a name="Grid-solve_same_number"><strong>solve_same_number</strong></a>(self)</dt><dd><tt>Solves&nbsp;the&nbsp;grid&nbsp;implementing&nbsp;the&nbsp;fact&nbsp;that&nbsp;there&nbsp;is&nbsp;always&nbsp;the&nbsp;same<br>
number&nbsp;of&nbsp;red&nbsp;and&nbsp;blue&nbsp;on&nbsp;the&nbsp;same&nbsp;line&nbsp;or&nbsp;column.<br>
&nbsp;<br>
:return:&nbsp;True&nbsp;if&nbsp;a&nbsp;square&nbsp;has&nbsp;been&nbsp;modified,&nbsp;else&nbsp;False.<br>
:rtype:&nbsp;bool</tt></dd></dl>
<dl><dt><a name="Grid-solve_threes"><strong>solve_threes</strong></a>(self)</dt><dd><tt>Solves&nbsp;the&nbsp;grid&nbsp;recursively&nbsp;to&nbsp;prevent&nbsp;'three&nbsp;in&nbsp;a&nbsp;row'.<br>
&nbsp;<br>
:return:&nbsp;True&nbsp;if&nbsp;a&nbsp;square&nbsp;has&nbsp;been&nbsp;modified,&nbsp;else&nbsp;False.<br>
:rtype:&nbsp;bool</tt></dd></dl>
<dl><dt><a name="Grid-square"><strong>square</strong></a>(self, horiz, vert)</dt><dd><tt>Used&nbsp;to&nbsp;get&nbsp;a&nbsp;specific&nbsp;square&nbsp;in&nbsp;the&nbsp;grid.<br>
&nbsp;<br>
:param&nbsp;horiz:&nbsp;The&nbsp;horizontal&nbsp;position&nbsp;of&nbsp;the&nbsp;square&nbsp;to&nbsp;get.<br>
:type&nbsp;horiz:&nbsp;int<br>
:param&nbsp;vert:&nbsp;The&nbsp;vertical&nbsp;position&nbsp;of&nbsp;the&nbsp;square&nbsp;to&nbsp;get.<br>
:type&nbsp;vert:&nbsp;int<br>
:return:&nbsp;The&nbsp;square&nbsp;at&nbsp;the&nbsp;given&nbsp;position<br>
:rtype:&nbsp;<a href="#Square">Square</a></tt></dd></dl>
<dl><dt><a name="Grid-squares_on_column"><strong>squares_on_column</strong></a>(self, col_number)</dt><dd><tt>Returns&nbsp;the&nbsp;squares&nbsp;on&nbsp;a&nbsp;column&nbsp;specified&nbsp;by&nbsp;the&nbsp;number<br>
(starting&nbsp;from&nbsp;zero).<br>
&nbsp;<br>
:param&nbsp;col_number:&nbsp;The&nbsp;column&nbsp;to&nbsp;get.<br>
:type&nbsp;col_number:&nbsp;int<br>
:return:&nbsp;The&nbsp;list&nbsp;containing&nbsp;the&nbsp;squares&nbsp;on&nbsp;the&nbsp;required&nbsp;column.<br>
:rtype:&nbsp;list</tt></dd></dl>
<dl><dt><a name="Grid-squares_on_line"><strong>squares_on_line</strong></a>(self, line_number)</dt><dd><tt>Returns&nbsp;the&nbsp;squares&nbsp;on&nbsp;a&nbsp;line&nbsp;specified&nbsp;by&nbsp;the&nbsp;number<br>
(starting&nbsp;from&nbsp;zero).<br>
&nbsp;<br>
:param&nbsp;line_number:&nbsp;The&nbsp;line&nbsp;to&nbsp;get.<br>
:type&nbsp;line_number:&nbsp;int<br>
:return:&nbsp;The&nbsp;list&nbsp;containing&nbsp;the&nbsp;squares&nbsp;on&nbsp;the&nbsp;required&nbsp;line.<br>
:rtype:&nbsp;list</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>squares</strong></dt>
<dd><tt>A&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;squares&nbsp;in&nbsp;the&nbsp;grid.<br>
:return:&nbsp;The&nbsp;squares&nbsp;in&nbsp;the&nbsp;grid.<br>
:rtype:&nbsp;list</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Square">class <strong>Square</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Represents&nbsp;a&nbsp;square&nbsp;in&nbsp;the&nbsp;grid.<br>
A&nbsp;square&nbsp;can&nbsp;be&nbsp;either&nbsp;Red,&nbsp;Blue,&nbsp;or&nbsp;Nothing,&nbsp;depending&nbsp;on&nbsp;the&nbsp;text<br>
written&nbsp;in&nbsp;it&nbsp;and&nbsp;displayed&nbsp;('R',&nbsp;'B'&nbsp;or&nbsp;'&nbsp;').<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Square-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl>
<dl><dt><a name="Square-__hash__"><strong>__hash__</strong></a>(self)</dt></dl>
<dl><dt><a name="Square-__init__"><strong>__init__</strong></a>(self, grid, vert, horiz, state=' ', base=False)</dt></dl>
<dl><dt><a name="Square-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>
<dl><dt><a name="Square-all_next_horiz"><strong>all_next_horiz</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;list&nbsp;of&nbsp;all&nbsp;next&nbsp;squares,&nbsp;horizontally.<br>
&nbsp;<br>
:return:&nbsp;A&nbsp;list&nbsp;containing&nbsp;all&nbsp;the&nbsp;next&nbsp;squares&nbsp;horizontally.<br>
:rtype:&nbsp;list<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-next_horiz">next_horiz</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<dl><dt><a name="Square-all_next_vert"><strong>all_next_vert</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;list&nbsp;of&nbsp;all&nbsp;next&nbsp;squares,&nbsp;vertically.<br>
&nbsp;<br>
:return:&nbsp;A&nbsp;list&nbsp;containing&nbsp;all&nbsp;the&nbsp;next&nbsp;squares&nbsp;vertically.<br>
:rtype:&nbsp;list<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-next_vert">next_vert</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<dl><dt><a name="Square-all_prev_horiz"><strong>all_prev_horiz</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;list&nbsp;of&nbsp;all&nbsp;previous&nbsp;squares,&nbsp;horizontally.<br>
&nbsp;<br>
:return:&nbsp;A&nbsp;list&nbsp;containing&nbsp;all&nbsp;the&nbsp;previous&nbsp;squares&nbsp;horizontally.<br>
:rtype:&nbsp;list<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-prev_horiz">prev_horiz</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<dl><dt><a name="Square-all_prev_vert"><strong>all_prev_vert</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;list&nbsp;of&nbsp;all&nbsp;previous&nbsp;squares,&nbsp;vertically.<br>
&nbsp;<br>
:return:&nbsp;A&nbsp;list&nbsp;containing&nbsp;all&nbsp;the&nbsp;previous&nbsp;squares&nbsp;vertically.<br>
:rtype:&nbsp;list<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-prev_vert">prev_vert</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<dl><dt><a name="Square-is_empty"><strong>is_empty</strong></a>(self)</dt><dd><tt>Simply&nbsp;tells&nbsp;if&nbsp;the&nbsp;square&nbsp;contains&nbsp;nothing&nbsp;or&nbsp;not.<br>
&nbsp;<br>
:return:&nbsp;True&nbsp;if&nbsp;the&nbsp;square&nbsp;contains&nbsp;'&nbsp;',&nbsp;else&nbsp;False.<br>
:rtype:&nbsp;bool<br>
&nbsp;<br>
:Example:<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;<a href="#Square">Square</a>(None,&nbsp;0,&nbsp;0,&nbsp;'&nbsp;').<a href="#Square-is_empty">is_empty</a>()<br>
True<br>
&gt;&gt;&gt;&nbsp;<a href="#Square">Square</a>(None,&nbsp;0,&nbsp;0,&nbsp;'R').<a href="#Square-is_empty">is_empty</a>()<br>
False</tt></dd></dl>
<dl><dt><a name="Square-next_horiz"><strong>next_horiz</strong></a>(self)</dt><dd><tt>A&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;next&nbsp;square&nbsp;horizontally.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;next&nbsp;square,&nbsp;horizontally.<br>
:rtype:&nbsp;<a href="#Square">Square</a><br>
&nbsp;<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid</tt></dd></dl>
<dl><dt><a name="Square-next_vert"><strong>next_vert</strong></a>(self)</dt><dd><tt>A&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;next&nbsp;square&nbsp;vertically.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;next&nbsp;square,&nbsp;vertically.<br>
:rtype:&nbsp;<a href="#Square">Square</a><br>
&nbsp;<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid</tt></dd></dl>
<dl><dt><a name="Square-opposite_state"><strong>opposite_state</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;opposite&nbsp;state&nbsp;of&nbsp;the&nbsp;current&nbsp;<a href="#Square">Square</a>.<br>
&nbsp;<br>
The&nbsp;opposite&nbsp;state&nbsp;of&nbsp;'R'&nbsp;is&nbsp;'B',&nbsp;and&nbsp;vice-versa.<br>
The&nbsp;opposite&nbsp;state&nbsp;of&nbsp;'&nbsp;'&nbsp;is&nbsp;'&nbsp;'.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;opposite&nbsp;state&nbsp;of&nbsp;the&nbsp;current&nbsp;square.<br>
:rtype:&nbsp;str<br>
&nbsp;<br>
:Example:<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;<a href="#Square">Square</a>(None,&nbsp;0,&nbsp;0,&nbsp;'R').<a href="#Square-opposite_state">opposite_state</a>()<br>
'B'<br>
&gt;&gt;&gt;&nbsp;<a href="#Square">Square</a>(None,&nbsp;0,&nbsp;0,&nbsp;'&nbsp;').<a href="#Square-opposite_state">opposite_state</a>()<br>
'&nbsp;'</tt></dd></dl>
<dl><dt><a name="Square-prev_horiz"><strong>prev_horiz</strong></a>(self)</dt><dd><tt>A&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;previous&nbsp;square&nbsp;horizontally.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;previous&nbsp;square,&nbsp;horizontally.<br>
:rtype:&nbsp;<a href="#Square">Square</a><br>
&nbsp;<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid</tt></dd></dl>
<dl><dt><a name="Square-prev_vert"><strong>prev_vert</strong></a>(self)</dt><dd><tt>A&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;previous&nbsp;square&nbsp;vertically.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;previous&nbsp;square,&nbsp;vertically.<br>
:rtype:&nbsp;<a href="#Square">Square</a><br>
&nbsp;<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid</tt></dd></dl>
<dl><dt><a name="Square-same_column"><strong>same_column</strong></a>(self)</dt><dd><tt>List&nbsp;of&nbsp;squares&nbsp;in&nbsp;the&nbsp;same&nbsp;column.<br>
Does&nbsp;not&nbsp;include&nbsp;the&nbsp;considered&nbsp;square.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;list&nbsp;of&nbsp;the&nbsp;squares&nbsp;in&nbsp;the&nbsp;same&nbsp;column.<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-all_prev_vert">all_prev_vert</a>(),&nbsp;<a href="#Square-all_next_vert">all_next_vert</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<dl><dt><a name="Square-same_line"><strong>same_line</strong></a>(self)</dt><dd><tt>List&nbsp;of&nbsp;squares&nbsp;in&nbsp;the&nbsp;same&nbsp;line.<br>
Does&nbsp;not&nbsp;include&nbsp;the&nbsp;considered&nbsp;square.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;list&nbsp;of&nbsp;the&nbsp;squares&nbsp;in&nbsp;the&nbsp;same&nbsp;line.<br>
&nbsp;<br>
..&nbsp;seealso::&nbsp;<a href="#Square-all_prev_horiz">all_prev_horiz</a>(),&nbsp;<a href="#Square-all_next_horiz">all_next_horiz</a>()<br>
..&nbsp;warning::&nbsp;The&nbsp;square&nbsp;must&nbsp;be&nbsp;part&nbsp;of&nbsp;a&nbsp;grid.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>state</strong></dt>
<dd><tt>Allow&nbsp;to&nbsp;get&nbsp;square&nbsp;state.<br>
&nbsp;<br>
:return:&nbsp;The&nbsp;square&nbsp;state.&nbsp;Either&nbsp;'&nbsp;',&nbsp;'R'&nbsp;or&nbsp;'B'</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-non_space_element"><strong>non_space_element</strong></a>(line)</dt><dd><tt>Returns&nbsp;the&nbsp;number&nbsp;of&nbsp;non&nbsp;space&nbsp;characters&nbsp;in&nbsp;a&nbsp;string.<br>
&nbsp;<br>
:param&nbsp;line:&nbsp;The&nbsp;line&nbsp;where&nbsp;to&nbsp;count&nbsp;characters.<br>
:type&nbsp;line:&nbsp;str<br>
:return:&nbsp;The&nbsp;number&nbsp;of&nbsp;non&nbsp;space&nbsp;characters.<br>
:rtype:&nbsp;str<br>
&nbsp;<br>
:Example:<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;<a href="#-non_space_element">non_space_element</a>('Ceci&nbsp;est&nbsp;un&nbsp;test')<br>
13</tt></dd></dl>
<dl><dt><a name="-solve_three_square"><strong>solve_three_square</strong></a>(square)</dt><dd><tt>Prevent&nbsp;'three&nbsp;in&nbsp;a&nbsp;row'.<br>
&nbsp;<br>
Checks&nbsp;before&nbsp;and&nbsp;after&nbsp;the&nbsp;square&nbsp;if&nbsp;there&nbsp;are&nbsp;two&nbsp;squares&nbsp;of&nbsp;the<br>
same&nbsp;color&nbsp;in&nbsp;order&nbsp;to&nbsp;prevent&nbsp;'three&nbsp;in&nbsp;a&nbsp;row'.<br>
&nbsp;<br>
:param&nbsp;square:&nbsp;The&nbsp;<a href="#Square">Square</a>&nbsp;to&nbsp;check<br>
:type&nbsp;square:&nbsp;<a href="#Square">Square</a><br>
:return:&nbsp;A&nbsp;boolean&nbsp;:&nbsp;True&nbsp;if&nbsp;something&nbsp;has&nbsp;been&nbsp;done,&nbsp;else&nbsp;False.<br>
:rtype:&nbsp;bool</tt></dd></dl>
<dl><dt><a name="-string_from_list"><strong>string_from_list</strong></a>(line)</dt><dd><tt>Makes&nbsp;a&nbsp;string&nbsp;from&nbsp;a&nbsp;line&nbsp;of&nbsp;squares.<br>
&nbsp;<br>
:param&nbsp;line:&nbsp;A&nbsp;line&nbsp;(list)&nbsp;of&nbsp;squares&nbsp;to&nbsp;make&nbsp;a&nbsp;string&nbsp;from.<br>
:type&nbsp;line:&nbsp;list<br>
:return:&nbsp;A&nbsp;string&nbsp;containing&nbsp;all&nbsp;the&nbsp;states&nbsp;of&nbsp;the&nbsp;squares&nbsp;in&nbsp;the&nbsp;list.<br>
:rtype:&nbsp;str<br>
&nbsp;<br>
..&nbsp;warning::&nbsp;The&nbsp;items&nbsp;of&nbsp;the&nbsp;list&nbsp;must&nbsp;be&nbsp;squares&nbsp;or&nbsp;have&nbsp;an&nbsp;attribute<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;called&nbsp;'state'.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">gaugendre</td></tr></table>
</body></html>