递归函数与另一个函数python协作

时间:2015-04-27 01:06:51

标签: python recursion

我正在尝试制作游戏解决方案。它应该能够解决数独,即 找到每个方格中可用的每个可能的数字 这就是我所拥有的:

<xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>
 <xsl:param name="pFilePath" select="'file:///C:/temp/expressions.txt'"/>

 <xsl:variable name="vExprs" select="tokenize(unparsed-text($pFilePath), '\r?\n')"/>

  <xsl:template match="/*">
    <xsl:copy><xsl:apply-templates/></xsl:copy>
  </xsl:template>

  <xsl:template match=
   "text()[string-join(ancestor::*[position() ne last()]/name(), '/') = $vExprs]">
    <xsl:element 
      name="{string-join(ancestor::*[position() ne last()]/name(), '.')}">
      <xsl:value-of select="."/>
    </xsl:element>
  </xsl:template>
  <xsl:template match="text()"/>
</xsl:stylesheet>

两者都有效,但我无法让他们一起工作。我正在使用递归使其使用一个数字,并且在执行代码时,如果失败则会回溯。

我想要的是next_possible_moves只使用一个参数,所以我可以删除“row”和“col”。

使用内部带有X列表的列表,因此它代表“X次X”板。

0 个答案:

没有答案