共用方式為


Chess Problems in Small Basic

Today I'd like to introduce two chess problems posted in Small Basic forum.  You can use Unicode characters for chessmen in Small Basic programs.  e.g. ♟, ♞, ♝, ♜, ♛ and ♚.

Knight's Tour

The original post is here by Yvan Leduc.  This problem is also picked up in the challenge of this month.

A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is open.

KnightsTour06

This picture above shows a solution solved by WPV159-3.

8-Queens

This problem was a community suggestion by Amir CPS in Challenge of the Month - January 2013.

The 8-Queens problem in chess is to place 8 queens on a chess board such that none of the queens is threatening any of the others.  The problem is to input the 8 columns of the queens on the rows of a chess board, with 1 being the first column and 8 being the last, e.g. 1 2 3 4 5 6 7 8 means the queens are along the diagonal, which would not be a valid solution.

More Info about this problem

Write a program to test a user input guess.

Examples:

  • Enter board configuration: 2 4 6 8 3 1 7 5 - This is a valid configuration (as above).
  • Enter board configuration: 1 8 2 5 3 7 4 6 - This is NOT a valid configuration.

8-Queens02

This picture above shows that the pattern is not a solution: red queens are threatening others.  The ID of this program is QDX521.

Comments

  • Anonymous
    April 18, 2016
    The comment has been removed
  • Anonymous
    April 18, 2016
    These are some great solutions! Big thanks go to Amir CPS, Nonki, and Yvan Leduc!
  • Anonymous
    April 19, 2016
    i added some 3d to ur chess board nonki, and also some moves contol: FRV365play on small board, 3d is preview only
    • Anonymous
      April 21, 2016
      Yvan, thank you for your new challenge.Ed, thank you for your comment.Tryhest, wow 3D chess! awesome!
      • Anonymous
        April 24, 2016
        tx nonkyan inspiration animation: LBJ957
        • Anonymous
          April 27, 2016
          advanced inspiraton: MDK164includes pi,e,fi and e-un