Python + PyQt4でリバーシゲームを作成する

彼らはどういうわけか小さなプロジェクト-ゲームリバーシを書くように私たちに頼みました。

そして、私は今Pythonを学んでいるので、それについて書くことにしました。 PyQt4グラフィックライブラリと一緒に。

それでは、問題は何でしたか? SVNを作成して行きます! ( githubに移動)



ここに私が得た奇跡があります:

ゲームのスクリーンショット



ウィキペディアによると(そして私は彼女に完全に同意します)

このゲームでは、8×8セル(すべてのセルを同じ色にすることができます)のサイズの正方形のボードと64の特殊チップを使用します。 ボードセルには、左上隅から番号が付けられます。垂直-ラテン文字、水平-数字。 1人のプレイヤーは白をプレイし、もう1人のプレイヤーは黒をプレイします。 プレイヤーは、自分の「自分の」色でチップをボードセルに置きます。

ゲームの開始時に、4つのチップがボードの中央に配置されます。d5とe4に黒、d4とe5に白です。

  • 黒が最初の動きをします。 次に、プレイヤーは交代します。
  • 移動するとき、プレーヤーはボードのセルの1つにチップを配置し、この置かれたチップと既にボード上にある自分の色のチップの1つとの間に、水平、垂直、または斜めの連続した敵のチップの列があるようにします(つまり、チップの連続した列対戦相手は、両側のプレーヤーのチップによって「閉じられました」。 このターンで「クローズ」列に入った対戦相手のチップはすべて反対側に反転し(色を変更)、歩いたプレイヤーに移動します。
  • 1回の移動の結果、複数の敵チップの列が同時に「クローズ」された場合、すべての「クローズ」列にあるすべてのチップがフリップされます。
  • プレーヤーは、自分に可能な動きを選択する権利を有します。 プレーヤーに可能な動きがある場合、その動きを拒否することはできません。 プレーヤーに有効な動きがない場合、その動きは相手に渡されます。
  • ゲームは、すべてのチップがボードに配置されたとき、またはプレーヤーが誰も移動できないときに終了します。 ゲームの終了時に、各色のチップのカウントが実行され、ボード上のチップがより多く表示されているプレイヤーが勝者として宣言されます。 チップ数が等しい場合、タイがカウントされます。




私が知っているPythonは基本的なレベルです。 Google App Engineで何かを書きました(たとえば、YouTubeユーザーから便利なRSSフィードを取得するため松葉杖ですが、それはポイントではありません)。 ちょうどそのようなもの。 オイラープロジェクト (私が言わなければならない素晴らしいサイト)のため何か。 一般的に、それは演奏されました:)



Qtでは、気にしませんでした。 しかし、判明したように、把握することはまったく難しくありません。

ロシア語での基礎の基礎 。 また、 ここここのドキュメント。 PyQT4ディストリビューションと一緒にサンプルの良いベースがあり、それも私がそれを理解するのを助けました。



インタプリタとライブラリのインストールと設定に専念することは意味がありません。何度も噛まれており、落とし穴はありません。

私が書いたように、私は以前Qtで働いたことはありません。 そして最初の困難は、ウィジェットシステム、つまりユーザーとの相互作用が一般的にどのように構築されるかを扱うことでした。 ただし、原則として、例やドキュメントを参照して理解することは難しくありません。

次の困難は、単純なAIを書くことでした。 このアイデアは、インターネットの荒野のどこかでスパイされ、リバースに適応しました。

Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  1. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  2. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  3. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  4. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  5. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  6. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  7. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  8. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  9. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  10. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  11. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  12. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  13. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  14. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  15. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  16. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  17. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  18. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  19. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  20. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  21. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  22. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  23. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  24. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  25. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  26. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  27. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  28. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  29. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  30. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  31. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  32. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  33. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  34. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  35. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player



  36. Copy Source | Copy HTML def compStep (player): table = [ [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 5 , 3 , 1 , 1 , 3 , 5 , 2 ], [ 2 , 6 , 4 , 3 , 3 , 4 , 6 , 2 ], [ 8 , 8 , 6 , 5 , 5 , 6 , 8 , 8 ], [ 1 , 8 , 2 , 2 , 2 , 2 , 8 , 1 ] ] pX = [ 0 ] * 61 pY = [ 0 ] * 61 minE = 9 maxE = 0 NP = 0 for row in range ( 8 ): for col in range ( 8 ): E = eated(row, col, player) if (minE > table[row][col]) & (E < 255 ) & (E > 0 ): minE = table[row][col] NP = 0 maxE = 0 if (minE == table[row][col]) & (E < 255 ): if E > maxE: maxE = E NP = 1 pX[NP] = row pY[NP] = col elif E == maxE: NP = NP + 1 pX[NP] = row pY[NP] = col E = 1 makeStep(player, pX[E], pY[E]) area[pX[E]][pY[E]] = player







情報源は、興味があれば、自分で感じることができます。 誰でも知っている、起動に問題はありません(pyqt4ライブラリが必要です)。

http://reversi-free0u.googlecode.com/svn/trunk/main.py



更新:コードがGithubで利用可能になりました。 パフォーマンスを保証することはできません。



特に窓用。 エグゼニク。

http://reversi-free0u.googlecode.com/files/Reversi.7z



py2exeを使用してパックされています。 私は2つの問題に遭遇しました。



最初のもの:

最初は、ゲームのセルとチップの画像は、ゲームに挿入された写真でした。 また、パッケージ化されたアプリケーションはそれらを正常に認識しませんでした。

この問題は単純に解決されました-Qtを使用して画像をレンダリングすることにより(最初はこれを行うのが面倒でした)。



第二:

パッケージ化に成功したアプリケーションが実行されましたが、別のコンピューターでの作業を拒否しました。 少し調べてみると、この問題も簡単に解決できることがわかりました:)

ビジュアルスタジオライブラリが不足していることが判明しました。

py2exeでPython 2.6を真剣に使用したことはなく、経験もありません

この新しいマニフェストのもので、しかし、少しの実験はこのアプローチを示しました

単純なケースで動作するようです(VistaではなくXPマシンでのみテストしました!):



python 2.6を削除しました(「すべてのユーザー用」にインストールしたため)

「自分専用」に再度インストールしました。 このインストールはmsvcr90.dllをコピーしました

およびMicrosoft.VC90.CRT.manifestファイルをc:\ python26フォルダーに入れます。



次に、作成した非常に単純なスクリプト( 'print "Hi"')でpy2exeを実行しました。

実行可能ファイル。 この実行可能ファイルは、msvcr90.dllがあるマシンで正常に機能しました。

Windows \ SxS(またはその呼び出し方法)にインストールされていたが、別では実行されなかった

msvcr90.dllがWindows \ SxSにインストールされていないマシン。



次に、msvcr90.dllおよびMicrosoft.VC90.CRT.manifestファイルをdistにコピーしました

py2exeが実行可能ファイルを作成したフォルダー。 これで、exeは両方のマシンで動作します。



単純なwxPythonスクリプトpy2exeで同じことをしようとしたときにクラッシュしたのは、

msvcp90.dll(IIRC)をロードしようとしましたが、見つかりませんでした(インストールされているようです)

Windows \ SxSフォルダ内)。 これはpy2exeのバグである可能性があります。
つまり、最も難しいのは、プログラムにライブラリとマニフェストファイルを配置することです。



主な欠点は、作成されるアプリケーションのサイズが大きいことです。 しかし、何もすることはありません。 すべて同じですが、pythonはインタープリター言語です。



この週末はゲームに何を費やしましたか?

このトピックについて、招待を受けました


集合ブログに移動しました。 この人生ではすべてを試さなければなりません8)



upd:ソースの変数名をわずかに変更しました



upd2:苦しんでいる、Pythonバージョン2.6.4



All Articles