'v11
'Damit auch Pferde in der Arena bleiben... 2,2 .. 9,9
'..abcdefgh..
'............
'8.wbwbwbwb.8
'7.bwbwbwbw.7
'6.wbwbwbwb.6
'5.bwbwbwbw.5
'4.wbwbwbwb.4
'3.bwbwbwbw.3
'2.wbwbwbwb.2
'1.bwbwbwbw.1
'............
'..abcdefgh..
' (K) König, (K) King
' (D) Dame, (Q) Queen
' (T) Turm, (R) Rock
' (L) Läufer, (B) Bishop
' (S) Springer, (N) Knight
' (B) Bauer, (P) Pawn
' Schach - Chess, Schach Ansage - Check, Schachmatt - Checkmate
' https://en.wikipedia.org/wiki/Chess
' https://de.wikipedia.org/wiki/Schach
Set("TrueColor",1)
Font 2
cls
Declare Chessboard$[11,11]
Declare white_field%, black_field%, blank_field%
white_field% = rgb(255,206,158)
black_field% = rgb(209,139, 71)
blank_field% = ord(" ")
Proc odd
Parameters x%
Return TestBit(x%,0) <> 0
EndProc
Proc even
Parameters x%
Return TestBit(x%,0) = 0
EndProc
Proc empty_board
Declare s$,t$, i%,j%
s$ = " abcdefgh "
t$ = " 87654321 "
WhileLoop 0,11
i% = &loop
WhileLoop 0,11
j% = &loop
Chessboard$[i%,j%] = chr$(blank_field%)
EndWhile
EndWhile
WhileLoop 0,11
Chessboard$[ 0,&loop] = Mid$(s$,&loop+1,1)
Chessboard$[11,&loop] = Mid$(s$,&loop+1,1)
Chessboard$[&loop, 0] = Mid$(t$,1+&loop,1)
Chessboard$[&loop,11] = Mid$(t$,1+&loop,1)
EndWhile
EndProc
Proc chess_start_pos
Declare s$,t$, i%,j%
s$ = "TSLDKLST"
t$ = "BBBBBBBB"
WhileLoop 2,9
Chessboard$[2,&loop] = Mid$(s$,&loop-1,1)
Chessboard$[3,&loop] = Mid$(t$,&loop-1,1)
Chessboard$[8,&loop] = Mid$(t$,&loop-1,1)
Chessboard$[9,&loop] = Mid$(s$,&loop-1,1)
EndWhile
EndProc
/*
Proc show_field
Parameters i%, j%
Declare c$
c$ = Chessboard$[i%,j%]
Case (c$ = " ") or (c$ = "") : c$ = chr$(blank_field%)
color 0,15
If Between(i%,2,9) and Between(j%,2,9)
case even(i%) and odd(j%) : color 0,7
case odd(i%) and even(j%) : color 0,7
EndIf
Locate i% * 3+1,j% * 3+1 : print chr$(blank_field%);chr$(blank_field%);chr$(blank_field%);
Locate i% * 3+2,j% * 3+1 : print chr$(blank_field%);chr$(blank_field%);chr$(blank_field%);
Locate i% * 3+3,j% * 3+1 : print chr$(blank_field%);chr$(blank_field%);chr$(blank_field%);
Locate i% * 3+2,j% * 3+1 : print c$;
EndProc
*/
Proc show_field
Parameters i%, j%
Declare c$
c$ = Chessboard$[i%,j%]
Case (c$ = " ") or (c$ = "") : c$ = chr$(blank_field%)
color 0,15
If Between(i%,2,9) and Between(j%,2,9)
case even(i%) and odd(j%) : color 0,7
case odd(i%) and even(j%) : color 0,7
EndIf
Locate i%+1,j%+1 : print c$;
EndProc
Proc show_whole_board
Declare i%,j%
WhileLoop 0,11
j% = &loop
WhileLoop 0,11
i% = &loop
show_field(i%,j%)
EndWhile
EndWhile
EndProc
empty_board()
chess_start_pos()
show_whole_board()
waitinput
end
Alles anzeigen