N Towers Puzzle

Version 1.0.0.0 (2.01 KB) by ACLNM
My very simple version of the Eight Queens Puzzle.
272 Downloads
Updated 31 Jan 2013

View License

[Indices] = NTowersPuzzle( [entry]);
[Indices Board] = NTowersPuzzle( [entry]);

Input formats:
NTowersPuzzle( [empty] or [invalid] ) => default
NTowersPuzzle( P ) => startposition is (P, P)
NTowersPuzzle( L, C) => startposition is (L, C)
NTowersPuzzle( L, C, N) => startposition is (L, C) on N-by-N board

This is my very limited version of the Eight Queens Puzzle (chess).
It produces a N-number Towers on a N-by-N chess board, ence the name.
The board is considered to be a N-by-N matrix.
The pieces positions are signed by ONEs and the positions without pieces
are signed by ZEROs.
The user is allowed to decide the position of the starting piece.
If not empty or invalid input, the default board size is 8-by-8.
If starting piece position is invalid, it produces random position.
The function itself may return two different arguments:
the first is a vector with the coordinates of the pieces;
the second is the matrix with signed position of the pieces.
It prints the coordinates and the board.

@ ACx // Janeiro 2013

Cite As

ACLNM (2024). N Towers Puzzle (https://www.mathworks.com/matlabcentral/fileexchange/40106-n-towers-puzzle), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Strategy & Logic in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0