Skip to content

The knights problem solved by checking all the possibilities (naive) using a stack data structure

Notifications You must be signed in to change notification settings

efraimrodrigues/knights-problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knights problem

Consider the traditional chess game played over a chessboard of eight columns and eight rows. Each piece can atack a set of positions around it. In particular, the knight atacks in L. This move consists of moving one line and then two columns or two lines and one column.

In this code a file gives the size of the chessboard as well as some positions that cannot have knights placed. So given an initial configuration of the chessboard our approach is to try all the possible configurations such that we find the maximum number of knights that can be placed in the initial chessboard.

File description

The first line indicates the size of the chessboard and the second line indicates the number of forbidden positions for knights to be placed. The following lines point to the positions which cannot have knights placed. The x axis is represented by letters as the y axis is represented by numbers.

This is very basic example file:

4
2
b4
d1

About

The knights problem solved by checking all the possibilities (naive) using a stack data structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages