Chess player: Difference between revisions
Content added Content deleted
(→{{libheader|python-chess}}: try to avoid mate in one) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 21: | Line 21: | ||
Encontrado en: http://www.petesqbsite.com/sections/express/issue23/Tut_QB_Chess.txt |
Encontrado en: http://www.petesqbsite.com/sections/express/issue23/Tut_QB_Chess.txt |
||
< |
<syntaxhighlight lang=qbasic>DEFINT A-Z |
||
DECLARE SUB SQUARE (A, B, C) |
DECLARE SUB SQUARE (A, B, C) |
||
Line 496: | Line 496: | ||
PRINT MT$ |
PRINT MT$ |
||
COLOR 7, 0 |
COLOR 7, 0 |
||
END SUB</ |
END SUB</syntaxhighlight> |
||
Line 508: | Line 508: | ||
some moves require history (the current state of the board is not sufficient for castling and en passant). |
some moves require history (the current state of the board is not sufficient for castling and en passant). |
||
I also wanted to try different methods of making moves. It does not play well, but then neither do I. |
I also wanted to try different methods of making moves. It does not play well, but then neither do I. |
||
< |
<syntaxhighlight lang=perl>#!/usr/bin/perl |
||
use strict; |
use strict; |
||
Line 939: | Line 939: | ||
then left click on the square the opponent's Pawn skipped over. |
then left click on the square the opponent's Pawn skipped over. |
||
END |
END |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 963: | Line 963: | ||
The computer may say some things that allude to the chess game in ''2001: A Space Odyssey'', by the way. |
The computer may say some things that allude to the chess game in ''2001: A Space Odyssey'', by the way. |
||
< |
<syntaxhighlight lang=python># Simple Python chess engine |
||
# Computer plays Black |
# Computer plays Black |
||
Line 1,036: | Line 1,036: | ||
print(f"Game finished, result is {board.result()}") |
print(f"Game finished, result is {board.result()}") |
||
hal9000()</ |
hal9000()</syntaxhighlight> |
||
{{Output}} (in ASCII) |
{{Output}} (in ASCII) |
||
<pre>$ python3 simplechess.py |
<pre>$ python3 simplechess.py |
||
Line 1,107: | Line 1,107: | ||
{{libheader|Wren-ioutil}} |
{{libheader|Wren-ioutil}} |
||
{{libheader|Wren-str}} |
{{libheader|Wren-str}} |
||
< |
<syntaxhighlight lang=ecmascript>import "/trait" for Stepped |
||
import "/fmt" for Fmt |
import "/fmt" for Fmt |
||
import "/ioutil" for Input, Output |
import "/ioutil" for Input, Output |
||
Line 1,669: | Line 1,669: | ||
} |
} |
||
Chess.start()</ |
Chess.start()</syntaxhighlight> |