Jump to content

Chess player: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 14:
 
or use those components as part of a complete program, demonstrating your language's support for modularity.
 
 
=={{header|BASIC}}==
{{works with|QBasic}}
Line 21 ⟶ 19:
 
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)
Line 497 ⟶ 495:
COLOR 7, 0
END SUB</syntaxhighlight>
 
 
=={{header|Go}}==
There are a number of open source Chess programs written in Go on Github.
 
Rather than spend a lot of time trying to write my own (likely mediocre) program, I thought I'd simply post a link to [https://github.com/notnil/chess notnil/chess] which explains its various capabilities quite well. However, you need to look at the code itself to see that it can cope with all types of move including castling, ''en passant'' capture and promotion to a piece of the player's choice.
 
=={{header|Perl}}==
Primarily written to see if I could find all moves with one regex. The answer was "mostly", the main problem being
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.
<syntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict;
Line 940 ⟶ 935:
END
}</syntaxhighlight>
 
=={{header|Phix}}==
Version 0.8.1+ contains demo\rosetta\chess.exw, a slightly cleaned-up copy of a 20-year old translation of TSCP.<br>
It isn't particularly good (though perhaps a reasonable starting point for something better), at over 1,600 lines it does not really bear any useful comparison to the lisp version, and is simply not worth posting on this site, especially in light of potential copyright issues.
 
=={{header|PicoLisp}}==
{{:Chess player/PicoLisp}}
 
=={{header|Python}}==
==={{libheader|pygame}}===
Line 963 ⟶ 955:
 
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
 
Line 1,100 ⟶ 1,092:
18.Ke2 Bxa1 19.Kd2 Qxf1 20.Kc2 Qxf2+ 21.Kb1 Qb2# 0-1
</pre>
 
=={{header|Wren}}==
{{trans|BASIC}}
Line 1,107 ⟶ 1,098:
{{libheader|Wren-ioutil}}
{{libheader|Wren-str}}
<syntaxhighlight lang="ecmascript">import "/trait" for Stepped
import "/fmt" for Fmt
import "/ioutil" for Input, Output
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.