Check out Symmetric Chess, our featured variant for March, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

Earlier Reverse Order Later
Chess piece names with period in them[Subject Thread] [Add Response]
wdtr2 wrote on Tue, Jul 21, 2020 10:14 PM UTC:

if fn friend $moved:
   set msg join join $moved #codename " is friend";
   echo #msg;
elseif fn enemy $moved:
   set msg join join $moved #codename " is enemy ";
   echo #msg;
else:
   set msg join join join $moved #codename " is not friend or foe " $moved;
   echo #msg;
endif;

I need advice on programming.  I have a piece that is .rf,  it appears to me the function friend / enemy is not working.  That function friend is using isupper or islower.  I am guessing that the Period in .rf prevents the function friend to determine if it islower.   

Any suggestions how I can add .rf to the function friend?


🕸Fergus Duniho wrote on Wed, Jul 22, 2020 01:44 AM UTC in reply to wdtr2 from Tue Jul 21 10:14 PM:

I am guessing that the Period in .rf prevents the function friend to determine if it islower.

Yes, it does. The islower function returns true only when all characters in the string are lowercase.

I would suggest making a distinction between your notation and the piece labels. .rf is a piece label, but it should not be used for notation. Use completely alphabetic notation, and test the case of the notation rather than the case of the label. See the fairychess include file tutorial for details.


2 comments displayed

Earlier Reverse Order Later

Permalink to the exact comments currently displayed.