Skip to content
sanjitakrPublic

About

It is a CLI based game made for the course project of CProgramming course in Monsoon 25 (Semester 1).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

To compile: make
To run: ./twixt

Here
'R' represents Red
'B' represents BLack
'R\' represents linked R
'B\' represents linked B
'.' represents an empty space

Features of TWIXT:
The board updates upon moves being made.
The pegs autolink as long as there is no other piece blocking it from making that move.
The loop ends when there is a winner or the player chooses to exit the game.
The 'X' are forbidden boxes which no player can play any move in


How does the program work?
-There is a struct to store the board at a given point with the state of that cell and the player who has played in that box,
-It then checks if links are possible after every move in all 8 directions depending on the row and column constraints
-While checking for links before making the link we check for a block and if there is a block the link will not be made,
-The block is formed by finding if the 2 line segments of the  2 pairs of pegs have any intersection or not
-After each move we then run a recursive function which converts each position in our box to a node in our adjacency matrix and we check
if we can reach from any cell on a players side to the opposite side through the connections it has made . The adjacency matrix follows 
a different convention where in the matrix the empty cells are represented by 0 , black peg links by 2 and red peg links by 1.We ensure we don't 
visit the same cell twice by setting all cells visited in the recursion to 1 in our visited array and only check those which are still at zero
-Then if a link is possible the game ends and if not our loop will continue unless the player chooses to stop,

About

It is a CLI based game made for the course project of CProgramming course in Monsoon 25 (Semester 1).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages