The negative powers of two are what happens when you start at 1 and keep dividing by 2. Although normally fractional numbers of this sort can’t exist for the integer type, I can simulate it using an array of decimal digits and my pattern recognition to write the small program below which gives the correct digits.
/*negative powers of two*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
/*most important variable: number of digits*/
int length=64;
char *a;
int alength=2,x,y,temp;
a=(char*)malloc(length*sizeof(*a));if(a==NULL){printf("Failed to create array a\n");return(1);}
x=0;
while(x<length)
{
a[x]=0;
x++;
}
a[0]=1;
while(alength<length)
{
printf("%i.",a[0]);
x=1;
while(x<alength)
{
printf("%d",a[x]);
x++;
}
printf("\n");
y=0;
x=0;
while(x<length)
{
if( (a[x]&1)==1 ){temp=5;}else{temp=0;}
a[x]>>=1;
a[x]+=y;
y=temp;
x++;
}
if(a[alength]>0){alength++;}
}
if(a!=NULL){free(a); a=NULL;}
return 0;
}
I know this post is not exactly Chess related but I am thinking of using this site to double as a way to share some of my computer programming code too. I also may be able to create mathematical data structures to represent the game of Chess in some way.
I am writing a book about Chess and so I may sometimes share cool programs like this that are heavily math related. My obsession with numbers is how I got my start in programming originally.
At first I forgot to specify the /usr prefix. I messed up my system and nothing was compiling because the default /usr/local was where the new install was whereas all the other libraries were installed in subdirectories of /usr.
Therefore I had to repead the command and then remove the sdl2-config file from the /usr/local/bin directory.
Then everything compiled as before, even my Tetris game and my new LGBT font library.
Technically I did not need the latest SDL2 version available but I wanted to learn how to install updates from source rather than only relying on the Debian repositories.
This is because I am considering making my own Linux distribution.
This post isn’t Chess related but it is still very nerdy. I have made 3 different SDL programs that all do the exact same thing. However they are written using different SDL versions over time as the API has changed. Therefore, SDL version 1,2, and 3 source code is provided as well as the commands to compile them!
SDL Version 1
#include <stdio.h>
#include <SDL.h>
int width=1280,height=720;
int loop=1;
SDL_Surface *surface;
SDL_Event e;
int main(int argc, char **argv)
{
if(SDL_Init(SDL_INIT_EVERYTHING)){return 1;}
SDL_putenv("SDL_VIDEO_WINDOW_POS=center");
SDL_WM_SetCaption("SDL1 Program",NULL);
surface=SDL_SetVideoMode(width,height,32,SDL_SWSURFACE);
if(surface==NULL){return 1;}
SDL_FillRect(surface,NULL,0xFF00FF);
while(loop)
{
while(SDL_PollEvent(&e))
{
if(e.type==SDL_QUIT){loop=0;}
if(e.type==SDL_KEYUP){if(e.key.keysym.sym==SDLK_ESCAPE){loop=0;}}
}
SDL_Flip(surface);
}
SDL_Quit();
return 0;
}
/*
SDL1 program that creates a window but nothing else.
Closes when user presses Esc or clicks the X of the window.
This is to test whether SDL1 programs can be compiled.
With the sdl-config script:
gcc -Wall -ansi -pedantic sdl1-test.c -o sdl1-test `sdl-config --cflags --libs` && ./sdl1-test
Without the sdl-config script:
gcc -Wall -ansi -pedantic sdl1-test.c -o sdl1-test -I/usr/include/SDL -D_GNU_SOURCE=1 -L/usr/lib/x86_64-linux-gnu -lSDL && ./sdl1-test
*/
SDL Version 2
#include <stdio.h>
#include <SDL.h>
int width=1280,height=720;
int loop=1;
SDL_Window *window;
SDL_Surface *surface;
SDL_Event e;
int main(int argc, char **argv)
{
if(SDL_Init(SDL_INIT_VIDEO))
{
printf( "SDL could not initialize! SDL_Error: %s\n",SDL_GetError());return -1;
}
window=SDL_CreateWindow("SDL2 Program",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,width,height,SDL_WINDOW_SHOWN );
if(window==NULL){printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );return -1;}
surface = SDL_GetWindowSurface( window ); /*get surface for this window*/
SDL_FillRect(surface,NULL,0xFF00FF);
SDL_UpdateWindowSurface(window);
printf("SDL Program Compiled Correctly\n");
while(loop)
{
while(SDL_PollEvent(&e))
{
if(e.type == SDL_QUIT){loop=0;}
if(e.type == SDL_KEYUP)
{
if(e.key.keysym.sym==SDLK_ESCAPE){loop=0;}
}
}
}
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
/*
This source file is an example to be included in Chastity's Code Cookbook. This example follows the SDL version 2 which works differently than the most up to date version (version 3 at this time). There is also an updated version in the same repository that works with version 3.
Linux Compile Command:
With the sdl2-config script:
gcc -Wall -ansi -pedantic sdl2-test.c -o sdl2-test `sdl2-config --cflags --libs` && ./sdl2-test
Without the sdl2-config script:
gcc -Wall -ansi -pedantic sdl2-test.c -o sdl2-test -I/usr/include/SDL2 -lSDL2 && ./sdl2-test
*/
SDL Version 3
#include <stdio.h>
#include <SDL.h>
int width=1280,height=720;
int loop=1;
SDL_Window *window;
SDL_Surface *surface;
SDL_Event e;
int main(int argc, char **argv)
{
if(!SDL_Init(SDL_INIT_VIDEO))
{
printf( "SDL could not initialize! SDL_Error: %s\n",SDL_GetError());return -1;
}
window=SDL_CreateWindow("SDL3 Program",width,height,0);
if(window==NULL){printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );return -1;}
surface = SDL_GetWindowSurface( window ); /*get surface for this window*/
SDL_FillSurfaceRect(surface,NULL,0xFF00FF);
SDL_UpdateWindowSurface(window);
printf("SDL Program Compiled Correctly\n");
while(loop)
{
while(SDL_PollEvent(&e))
{
if(e.type == SDL_EVENT_QUIT){loop=0;}
if(e.type == SDL_EVENT_KEY_UP)
{
if(e.key.key==SDLK_ESCAPE){loop=0;}
}
}
}
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
/*
This source file is an example to be included in Chastity's Code Cookbook. By following the migration guide, I converted the SDL2-test program to the changes in SDL3.
https://wiki.libsdl.org/SDL3/README-migration
Windows Compile Command:
gcc -Wall -ansi -pedantic sdl3-test.c -o sdl3-test -IC:/w64devkit/include/SDL3 -lSDL3 && sdl3-test
Linux Compile Command:
gcc -Wall -ansi -pedantic sdl3-test.c -o sdl3-test -I/usr/include/SDL3 -lSDL3 && ./sdl3-test
*/
No matter which of those I compile and run, I get the same result:
All the programs do is create a window and fill the whole thing with Magenta. It’s not that exciting, but it is pretty, and it shows that all 3 versions of SDL work on my Debian Linux machine.
This is an example of custom written HTML for a table representing a Chessboard. This version does not use CSS and instead styles every single element individually. The reason is because I am unable to control the CSS of WordPress the way I want. This should work for embedding a table of a Chessboard into any WordPress post I want. Creating an HTML table is an idea I had to save disk space if I were to make a personal database of Chess positions and my thoughts on various moves.
There are other ways to make a text form of a Chess board. For example, consider this table made using Markdown:
a
b
c
d
e
f
g
h
8
r
n
b
q
k
b
n
r
7
p
p
p
p
p
p
p
p
6
5
4
3
2
P
P
P
P
P
P
P
P
1
R
N
B
Q
K
B
N
R
The Markdown code that makes the above table is:
||a|b|c|d|e|f|g|h|
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| 8 | r | n | b | q | k | b | n | r |
| 7 | p | p | p | p | p | p | p | p |
| 6 | | | | | | | | |
| 5 | | | | | | | | |
| 4 | | | | | | | | |
| 3 | | | | | | | | |
| 2 | P | P | P | P | P | P | P | P |
| 1 | R | N | B | Q | K | B | N | R |
However, the Markdown version, although it displays fine when viewed on Github, does not play well with WordPress. Therefore, the HTML version at the top of this post is much more reliable for WordPress posts.
Reading the code on the other hand is another story! The following HTML code made the table at the very top of this post.
When considering the difficulty of getting a workable table to display on my blog, you may wonder why I bother? Consider the following image which is the equivalent starting position of Chess.
Obviously, this image looks better than the lame table at the top of this post, but it comes with a few downsides.
First, the amount of time it takes to load up inkscape, move the pieces around for the image, choose a file name to save as, upload the file to my WordPress media account, and then write a Markdown link to the image is far more than the time it takes to edit the HTML code to mode the pieces of text around.
Second, linking to image files adds the dependency of external files existing and the internet connection working. By keeping the table as plain text, it allows me to work offline and save time and space in the creation of the image and my explanations of that position.
Therefore, I have decided to use the HTML table method for some time as I build content for my next Chess book. However, it will not be done any time soon. The first book was for beginners, but the next book will hopefully be for the more advanced and skilled player.
What you see above is an HTML table representation of a Chess board. It is not perfect, but it is a convenient way to avoid the use of images when creating documentation on different Chess positions. Using plain text saves a lot of space compared to the space required to make millions of Chess images for every possible move. The white pieces are represented with capital letters and the black by lowercase letters.
Of course, I don’t intend to document every move that could occur in every Chess game. Instead, I want to cover those that happen in real games with humans. The idea is approximately one blog post per day where I analyze the board from my human perspective and then write what I think the best move is.
Unlike a Chess engine, I can explain the reason for my moves in a position. This could be used for future Chess books after I have written good explanations of why I recommend a move in a given position.
In any case, my recommended move from the starting position will always be d4, which means move the pawn in front of the white queen to d4.
Later on, I may cover openings starting with e4, but because they are too popular and overused, I will be sticking with my openings beginning with d4. The idea is one post per day because this is a small step that is easy to fit into my busy schedule.
Unfortunately, my table does not display on WordPress the way it does on other sites like Github. I am working on ways to resolve this with HTML or CSS but my needs are very specific and this may take time.
Today’s post is not exactly Chess related other than the fact that this checkered dress I bought 7 years ago was purchased because I am obsessed with Chess and the pattern of the Chess board. My skills are not only limited to playing Chess and writing books. I also like to dance to all kinds of music. Enjoy this silly video of me dancing to “I Will Survive” by Gloria Gaynor.
When I first began playing Chess, I was obsessed with the Scholar’s Mate, which is when white wins the game in only 4 moves. Such occurrences are quite rare when playing against experienced players. However, I recently began thinking about how checkmates in under a certain number of moves could be useful.
If a game is won in very few moves, there is a high chance that the winning player did not make any mistakes. Also, in certain arena tournaments, the winning player of the tournament is who has the most points by winning more games. Those who know how to win games in fewer moves can simply get more wins in the same amount of time.
Therefore, I have written some instructions for using pgn-extract to find games with a certain number of maximum moves. I have previously mentioned how useful this command line tool is. If you download your own database of games from lichess.org, you can use my example commands by simply changing the names of the files and your username in the commands to find the games you have won the fastest.
How to Find Checkmates
the “–checkmate” flag is used to only output games that end in a checkmate instead of a resignation or a stalemate. See the example commands here.
This first command takes all of the games where chastitywhiterose was the white player and won the game by checkmate.
The documentation for pgn-extract shows that you can limit the length of games matched in database. By combining the “–checkmate” flag and the “–maxmoves” flag with a number as an option, you can find all the checkmates that happen up to that number of moves.
Because I am someone who usually plays the Queen’s Gambit opening as white and the French Defense as black, very few of my games end this quickly. My play style is to slowly wear my opponent down in a long classical game. But perhaps your style is to take your opponents down quickly before they even know what happened!
I suggest downloading and installing the pgn-extract tool and placing the path to it in your system settings so you can run commands to extract your best wins.
My own purpose in this is to identify games that I have played which are high quality enough to include in a future Chess book. Fast wins are quite satisfying.
Chastity’s Journey into a career in writing began in 2013 when she published a book titled “Confessions of a Confused Virgin”. This book project was intended to teach Chastity about the process of self-publishing a book so that she could help her mother, Judena Klebs, publish the books she had written.
However, the people on Facebook enjoyed Chastity’s different points of view on dating, marriage, and sex. After that, Chastity started blogging on a WordPress blog about whatever she had on her mind at the time. Eventually, these small posts became content for future books she would publish.
The majority of her writing was a series of conversations she had with a unicorn in a dream. The series remains forever published as “Chandler’s Honesty” because Chandler is her legal name even though she is known by her preferred name of Chastity White Rose. Unlike most transgender people, Chastity does not consider Chandler to be a “dead name” but instead a name of historical importance as she evolves from a caterpillar to a butterfly and yet remains the same person.
Chastity is a simple person who prefers playing Tetris or Chess much more than writing. However, she began a project in Pride month of 2025 with a focus on educating the public about the LGBTQIA+ community that is different than the hype you would hear from mainstream media.
Chastity graduated with a Creative Writing Degree in July of 2025 after attending Full Sail University as an online student while working full-time at Walmart in Lee’s Summit, Missouri.
Her best paperback books and ebooks can be purchased from Amazon, Apple Books, Google Play books, and many others. These works cover a range of topics, such as opinions on politics or religion, her Journey as an Asexual Transgender woman (Chandler’s Honesty), and even a 100-page book about the board game of Chess (Chastity’s Chess Chapters).
But beyond writing books and blog posts, Chastity is offering services to help others write and publish their books, blogs, and websites. Those who have a story to tell but who may not be as technologically inclined may benefit from her experience using Kindle Direct Publishing, Draft2Digital, WordPress, and writing content with Markdown and HTML.
Chastity writes on two main websites that she pays to keep free of ads and distractions.
Because I have not had the time to write much about Chess recently due to finishing school, moving, and still working full-time at Walmart, I would like to instead share a recent video from my Twitch stream. I don’t save every stream but this one was special because it was my first real Chess stream since I moved to my new house.
I have 5 roommates, one of which has even asked me to teach him Chess! I told him that is one of the things I do best.
I was very tired while playing this, but I really needed to play some Chess because I don’t get enough fun during the week. I made a few mistakes in these games, but my calculations and trickery were higher than usual. I won all 4 Chess games during this stream.
Today I take a small break from my usual Chess content with a few announcements and a request from my readers.
First, I will soon be graduating from Full Sail University with my Creative Writing degree. Second, I will be moving to a new place where I will be renting a room in a 6-bedroom house with 5 roommates. Each tenant, myself included, has their own separate lease with the property management. I am a little bit nervous about it, but I am doing it for financial reasons of needing to save on rent to pay off my student loans.
And that is not all. I also have been having Zoom meetings with Career coaches, who are guiding me in the direction of finding work as a writer. Part of my homework is to create a Technical Writing resume. I have spent quite some time over the past few weeks trying to make a resume that captures not only my writing skills but also my Chess teaching and video creation skills. I am sharing it in this post in the hopes that anyone who reads this blog can give me some feedback on it. I need to know how it looks to other humans instead of just what the AI on Indeed and vmock say about it.
Please leave me comments on what you like or dislike about my resume. If you were an employer looking to hire someone to write about whatever your product or service is, would my skills qualify me?