There's more than one way to do things PerlMonks

### Web Based Chess Server

by wombat (Curate)
 on Sep 15, 2000 at 23:38 UTC Need Help??
endhere \$linecount=1; for(0..63) #Build the html of the new board. { \$_ = \$board[\$_]; print nBRD \$_; if (\$_ eq '0'){print NB "\n"} elsif (\$_ eq '1'){print NB "\n"} elsif (\$_ eq 'p'){print NB "\n"} elsif (\$_ eq 'P'){print NB "\n"} elsif (\$_ eq 'n'){print NB "\n"} elsif (\$_ eq 'N'){print NB "\n"} elsif (\$_ eq 'r'){print NB "\n"} elsif (\$_ eq 'R'){print NB "\n"} elsif (\$_ eq 'b'){print NB "\n"} elsif (\$_ eq 'B'){print NB "\n"} elsif (\$_ eq 'q'){print NB "\n"} elsif (\$_ eq 'Q'){print NB "\n"} elsif (\$_ eq 'k'){print NB "\n"} elsif (\$_ eq 'K'){print NB "\n"} \$count++; if (\$count==8) { \$count=0; \$linecount++; if(\$linecount<9){print nBRD "\n"; print NB "";} } } if (!\$board[64]){\$board[64]=1;} elsif (\$board[64]){\$board[64]=0;} {print nBRD "\n\$board[64]\n";} print NB <<"end_of_text";
1
\$linecount

1
2
3
4
5
6
7
8
PERLMONKS CHESS
"I once held the opinion that magnificent pieces allowed a person to p +lay a magnificent game. I quickly learned that my opinion was wrong." --Wombat
Black square White square
Pawn Rook
Knight Bishop
Queen King
See the log of moves and dialogue.

From Y: From X:
To Y: To X:
Do you have anything to say to your opponent?
end_of_text if (\$piece =~ '[pP]'){print LOG "Pawn --";} if (\$piece =~ '[bB]'){print LOG "Bishop --";} if (\$piece =~ '[kK]'){print LOG "King --";} if (\$piece =~ '[nN]'){print LOG "Knight --";} if (\$piece =~ '[rR]'){print LOG "Rook --";} if (\$piece =~ '[qQ]'){print LOG "Queen --";} \$fy++;\$fx++;\$ty++;\$tx++; print LOG "\$fy x \$fx to \$ty x \$tx
\n"; print LOG "\$mesg

\n"; \$cmd = "mv \$dir[3] \$dir[4]"; system (\$cmd); \$cmd = "mv \$dir[1] \$dir[0]"; system (\$cmd); print <<"HTML"; Okay! You moved, have a nice day.
Click here to re +turn to the board HTML sub no_piece_there { print "There isn't any piece there. Do not smoke crack while playin +g chess.\\$ exit (0); } sub not_your_turn { print "Not your turn, go away. :-P\n"; exit (0); } sub out_of_bounds { print "Invalid move, try again."; exit (0); }
Replies are listed 'Best First'.
RE: Web Based Chess Server
by isotope (Chaplain) on Sep 16, 2000 at 04:11 UTC

I like the idea.
--isotope
Re: Web Based Chess Server
by Anonymous Monk on Apr 27, 2004 at 22:55 UTC
I also such at chess, so naturally i'm interested in this. Great idea btw. I think I will modify it a bit so I can have multiple games going. That OK w/ you? Thanks

Create A New User
Node Status?
node history
Node Type: sourcecode [id://32724]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2018-04-22 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (83 votes). Check out past polls.

Notices?