Chess

A place for discussions that are NOT related to the US Hawks. This area is provided for the convenience of our members, but the US Hawks specifically does not endorse any comments posted in these forums.
Forum rules
Be Polite!!

This forum is for discussions that are NOT related to the US Hawks. This area is provided for the convenience of our members, but the US Hawks specifically does not endorse any comments posted in this forum.

Chess

Postby Bob Kuczewski » Sat Nov 20, 2021 12:13 pm

This may be off topic, but Chris has been wanting to play chess, so I figured I'd try to see if we can do that here on the forum. If anyone objects, I can move it to the Free Speech Zone (which I decided to do anyway).

So, here's what a chess board looks like in our normal BBCode:

 ♜  ♞  ♝  ♛  ♚  ♝  ♞  ♜ 
 ♟  ♟  ♟  ♟  ♟  ♟  ♟  ♟ 
                        
                        
                        
                        
 ♙  ♙  ♙  ♙  ♙  ♙  ♙  ♙ 
 ♖  ♘  ♗  ♕  ♔  ♗  ♘  ♖ 


It looks a little messy inside, but you should be able to quote this post and move the pieces around.

However, there's a problem with Android tablets and cell phones. On those devices, the empty squares are only half as wide as squares containing a chess piece. So I've also worked on a table-based approach below.
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Chess

Postby Bob Kuczewski » Sat Nov 20, 2021 7:34 pm

This version is based on tables, and it's a little easier to use than the previous version ...





 ♜  ♞  ♝  ♛  ♚  ♝  ♞  ♜ 
 ♟  ♟  ♟  ♟  ♟  ♟  ♟  ♟ 
                
                
                
                
 ♙  ♙  ♙  ♙  ♙  ♙  ♙  ♙ 
 ♖  ♘  ♗  ♕  ♔  ♗  ♘  ♖ 

I'm not sure why it doesn't start at the top of the post, but that's something that can be worked on. I think it's ready to play!!

I suggest that when a match is started, the topic title should start with "Chess Match:", followed by the player's names, followed by the date like this example:

Chess Match: Chris vs Bob, November 20, 2021
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Chess

Postby Bob Kuczewski » Sat Nov 20, 2021 11:10 pm

Aha! I figured out why the chess board didn't start at the top of the page. I had used carriage returns inside of my table, and the BBCode processor doesn't seem to know where to put them in the resulting HTML, so it puts them in front of the table. In this version, I removed all carriage returns, and the table starts where it should:

 ♜  ♞  ♝  ♛  ♚  ♝  ♞  ♜ 
 ♟  ♟  ♟  ♟  ♟  ♟  ♟  ♟ 
                
                
                
                
 ♙  ♙  ♙  ♙  ♙  ♙  ♙  ♙ 
 ♖  ♘  ♗  ♕  ♔  ♗  ♘  ♖ 

In retrospect it makes some sense. In HTML, all white space (spaces, tabs, carriage returns, line feeds) is ignored. To force a new line in HTML, you have to use an explicit tag (like "br" or "p"). But BBCode is meant to be easier, and it lets you use regular new lines in your code to make new lines in the HTML. So while new lines in a table shouldn't have any effect on HTML, these new lines were appearing in the BBCode, and it tried to add the HTML breaks for each new line ... somewhere. I think it's a bug in the BBCode translator to put those newlines outside the table, but it may also be considered a "feature". Either way, the lesson is clear: don't use carriage returns or line feeds inside of a chess table!!
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Chess

Postby Bob Kuczewski » Sun Nov 21, 2021 12:52 am

This is a test of the Rotate_Chess_BBCode.py program:

 ♖  ♘  ♗  ♔  ♕  ♗  ♘  ♖ 
 ♙  ♙  ♙  ♙  ♙  ♙  ♙  ♙ 
                
                
                
                
 ♟  ♟  ♟  ♟  ♟  ♟  ♟  ♟ 
 ♜  ♞  ♝  ♚  ♛  ♝  ♞  ♜ 


This functionality was eventually added to the ChessBoard_on_USHawks.html file as JavaScript (see post below).
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Chess

Postby Bob Kuczewski » Wed Nov 24, 2021 1:06 am

The BBCode for playing chess seems to be pretty stable at this point in time. But it is still pretty complicated to use by hand.

In order to make this easier, I've written a fairly simple JavaScript program within a web page titled ChessBoard_on_USHawks.html. Here's what it looks like:

Screenshot_2021_11_23.png
Screenshot_2021_11_23.png (22.8 KiB) Viewed 16 times


The program has a number of features. It lets you move pieces by clicking on each piece (turns pink) and then clicking on the new location. The piece will replace any other piece already in the new location. The program also lets you save the current state as either FEN-encoded text, Unicode text, or BBCode text (which appears in the lower text window). The FEN-encoded text can also be rotated and loaded back into the board to view from the other player's perspective. The BBCode output can be copied directly from the program's text window and pasted into a USHawks post for display. You can also edit the text or load new text copied from some other source and update the board from that text.

The program is attached below as a zip file. When you unzip it, you should have a file named "ChessBoard_on_USHawks.html". If you open that file in your browser (usually a "double click" on the file will do that), you should see the main chess board as shown in the image above.

Enjoy!!
Attachments
ChessBoard_on_USHawks.html.zip
(2.85 KiB) Not downloaded yet
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Chess

Postby Bob Kuczewski » Thu Dec 02, 2021 4:34 am

Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
User avatar
Bob Kuczewski
Contributor
Contributor
 
Posts: 7182
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA


Return to Free Speech Zone / Off-Mission Discussions

Who is online

Users browsing this forum: No registered users and 7 guests