def futureCheckMate(chess): p = '' p += """<table border='0' >\n""" p += """\t<tr>\n""" p += """\t<th >""" p += """ Piece""" p += """</th>\n""" p += """\t<th>""" p += """to""" p += """</th>\n""" p += """\t<th>""" p += chess.whiteOrBlack()[1] p += """</th>\n""" p += """\t<th>""" p += """from""" p += """</th>\n""" p += """\t<th>""" p += """Check Mate""" p += """</th>\n""" p += """\t<th>""" p += '' p += """\t</th>\n""" p += """\t</tr>\n\n""" for p0, p1, r, f, r1, f1, checkmate in chess.IsCheckMate(): p += """\t<tr> """ p += """\t<td valign='top' >""" p += str(p0) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(f,r) p += """</td>\n""" p += """\t<td align='center' >""" p += str(p1) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(f1,r1) p += """</td>\n""" p += '<td>' #p += str(checkmate) p += '</td>' p += """\t</tr> """ p += """</table>\n""" return p
def futureCheck(chess): p = '' p += """<table border='0'>\n""" p += """\t<tr>\n""" p += """\t<th>""" p += """ Piece """ p += """</th>\n""" p += """\t<th>""" p += """to""" p += """</th>\n""" p += """\t<th>""" p += chess.whiteOrBlack()[1] p += """</th>\n""" p += """\t<th>""" p += """from""" p += """</th>\n""" p += """\t<th>""" p += """Check""" p += """</th>\n""" p += """\t<th>""" p += '' p += """\t</th>\n""" p += """\t</tr>\n\n""" count = 1 for x, x1, r, f, ranks, files, check in chess.IsCheck(): print('chess.IsCheck:', check) a1 = chess.arrayToNotation(f,r) a2 = chess.arrayToNotation(files,ranks) onmouseover = """ onmouseover="chess_future(""" onmouseover += str(r) onmouseover += """,""" onmouseover += str(f) onmouseover += """,""" onmouseover += str(files) onmouseover += """,""" onmouseover += str(ranks) onmouseover += """,""" onmouseover += str(chess.random_chess) onmouseover += """,""" onmouseover += 't' + str(count) onmouseover += """ )" """ onmouseout = """ onmouseout="chess_future_onmouseout(""" onmouseout += str(chess.random_chess) onmouseout += """)" """ p += """\t<tr id='t""" + str(count) + """' \n""" p += ' valign="top" ' p += '\t' + onmouseover + '\n' p += '\t' + onmouseout p += """ >\n""" p += """\t<td align='center' >""" p += str(chess.board[chess.board_move_user].piece(f, r)) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(f,r) p += """</td>\n""" p += """\t<td align='center' >""" p += str(x1) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(ranks,files) p += """</td>\n""" p += '<td>' p += '<table>' p += '<tr>\n' p += """\t<th>""" p += """ Piece""" p += """</th>\n""" p += """\t<th>""" p += """to""" p += """</th>\n""" p += """\t<th>""" p += '' p += """</th>\n""" p += """\t<th>""" p += """from""" p += """</th>\n""" p += """\t<th>""" p += """Check""" p += """</th>\n""" p += """\t<th>""" p += '' p += """\t</th>\n""" p += '</tr>\n' for p0, p1, r, f, r1, f1, check in chess.IsCheck(): print('chess.IsCheck:', check) a1 = chess.arrayToNotation(f,r) #print('a1:', a1) a2 = chess.arrayToNotation(f1,r1) #print('a2:', a2) p += '<tr>\n' p += '<td>\n' p += '' + str(p0) p += '</td>\n' p += '<td>\n' p += str(a1) p += '</td>\n' p += '<td>\n' p += str(p1) p += '</td>\n' p += '<td>\n' p += str(a2) p += '</td>\n' p += '<td>\n' p += str(check) p += '</td>\n' p += '</tr>\n' p += '</table>\n' p += '</td>' ran = chess.arrayToNotation(f,r)+' '+chess.arrayToNotation(ranks,files) p += """\t<form action='/future/""" + ran + """/"""+str(chess.random_chess)+"""'>\n""" p += """\t\t<td>""" p += """<button>Go</button>""" p += """</td>\n""" p += """\t</form>\n""" p += """\t</tr>\n\n""" count += 1 p += """</table>\n""" return p
def futureCheckEx(chess): p = '' p += """<table border='0'>\n""" p += """\t<tr>\n""" p += """\t<th>""" p += """ Piece FC!""" p += """</th>\n""" p += """\t<th>""" p += """to""" p += """</th>\n""" p += """\t<th>""" p += chess.whiteOrBlack()[1] p += """</th>\n""" p += """\t<th>""" p += """from""" p += """</th>\n""" p += """\t<th>""" p += """Check""" p += """</th>\n""" p += """\t<th>""" p += 'move up' p += """\t</th>\n""" p += """\t<th>""" p += '' p += """\t</th>\n""" p += """\t</tr>\n\n""" count = 1 for x, x1, r, f, ranks, files, move_up in chess.lookEx(): #print('look:', x) a1 = chess.arrayToNotation(f,r) a2 = chess.arrayToNotation(files,ranks) onmouseover = """ onmouseover="chess_future(""" onmouseover += str(r) onmouseover += """,""" onmouseover += str(f) onmouseover += """,""" onmouseover += str(ranks) onmouseover += """,""" onmouseover += str(files) onmouseover += """,""" onmouseover += str(chess.random_chess) onmouseover += """,""" onmouseover += 't' + str(count) onmouseover += """ )" """ onmouseout = """ onmouseout="chess_future_onmouseout(""" onmouseout += str(chess.random_chess) onmouseout += """)" """ p += """\t<tr id='t""" + str(count) + """' \n""" p += ' valign="top" ' p += '\t' + onmouseover + '\n' p += '\t' + onmouseout p += """ >\n""" p += """\t<td valign='top' >""" p += str(x) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(f,r) p += """</td>\n""" p += """\t<td align='center' >""" p += str(x1) p += """</td>\n""" p += """\t<td>""" p += chess.arrayToNotation(files,ranks) p += """</td>\n""" p += """\t<td>""" p += str(move_up) p += """</td>\n""" p += """\t<form action=''>\n""" p += """\t\t<td>""" p += """<button>Go</button>""" p += """</td>\n""" p += """\t</form>\n""" p += """\t</tr> """ count += 1 p += """</table>\n""" return p