the board position exactly last 'x' moves before the check

Are you sure you are talking about chess? :) A "check" is just a move when one of the kings is attacked by a piece from the opposite side. A winning situation is when your opponent's king is "checkmated" (or when your opponent resigns).

The purpose is to create boards to solve in 'x' moves.

Those "boards" in chess are called "problems" and they propose situations where you can checkmate in X moves. Alternatively, there are situations where one side moves and achieves a winning advantage (without a given number of moves), and they are called "studies". Which ones are you referring to?

Anyway, it isn't clear what you want to achieve. If you are trying to create a program for solving a chess problem, then have a look at some chess engines (Crafty and Baby Chess in particular). If you only want to represent positions, then you may use Chess::PGN::EPD, which can validate chess positions and moves and Chess::PGN::Parse, which can parse a game annotated in Portable Game Notation.

For a sample complete chess program, try SCID, a GPL chess project written in C++.

Update
Added references to more chess engines.

 _  _ _  _  
(_|| | |(_|><
 _|   

In reply to Re: Chess Moves by gmax
in thread Chess Moves by artist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.