Skip to content

meMuszr/c-tictactoc-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm

Encode a 3 x 3 tic-tac-toe board into a single 18-bit string [EMPTY = 00, X = 10, O = 01]

Create a mask for all non-empty tiles in a separate 18-bit string. Use predefined winning game-layout bitstrings (horizontal, vertical, diagonal)

/* 01 00 00 00 01 00 00 00 01 */ 0x10101,
/* 00 00 01 00 01 00 01 00 00 */ 0x01110,
/* 01 01 01 00 00 00 00 00 00 */ 0x15000, // shift thrice to drop a row
/* 01 00 00 01 00 00 01 00 00 */ 0x10410, // shift once to move a column

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages