Electronic Design
LabVIEW Files Implement Simple Chess Simulation

LabVIEW Files Implement Simple Chess Simulation

Based on National Instruments' LabVIEW package, this set of Virtual Instrument Files provides a user interface that simulates the functions of chess, and forms a basis for other user-friendly simulations.

Download this article in .PDF format
This file type includes high resolution graphics and schematics when applicable.
Student, Dept. of Electronics and Commincations Engineering, SASTRA University, India

This design describes a novel implementation of a brain-storming game in LabVIEW virtual instrument (VI) files. The innovative approach can trigger ideas for designers in the field of robotics, since the graphical menu-driven program has been instrumental in tracing the composition of various elements. The program is a simple implementation of the game "chess," and can be played with two (human) players in the LabVIEW background.

The program has nine VIs, of which eight are sub-VIs used in “VI chess” (posted online as LabVIEW LLB files). The VIs are simply split up the way we play the game in the real life. They provide the following basic functions, as each one's name indicates:

possible_moves.vi and moves.vi can do possible moves of each piece

type_of_place.vi can change the color of the box

type_of_piece.vi can change of color of the selected piece

initial_board.vi can initialize the positions of the pieces and the squares

move_from_to.vi can move the piece from one position to the other position

which_piece.vi can decide which piece to move next

enable_square.vi can enable the square

clicked.vi can check what happens when clicking a piece

Chess vi is the virtual instrument program for entire game of chess

1. The front-panel diagram of the LabVIEW Chess Game virtual-instrument program shows the basic 8 × 8 matrix in which these VIs are initialized.

These VIs are combined in a single VI called the game of chess. This basic 8 × 8 matrix initializes these VIs, with a front panel shown in Figure 1. In some cases, two VIs perform the same action to counter-check whether the action is properly simulated or not. The initial_board.vi resets the position of the board, the type of place, and piece, to ensure that only a specified square and pieces are placed on the board according to the existing conditions. Moves.vi defines each piece’s move, and other possible moves, and takes care of the moves of a particular piece at a particular instant in the game. Move_from_to.vi gives the recent move made by the player at the particular instant.

Figure 2 shows the functional blocks and palette diagram.The game starts by pressing the button ‘New Game’ and the coins are set in the appropriate positions using the sub VI (initial_board.vi). The “Current Move” text field shows whose turn it is to move, and the “Current Action” text field shows the movement action (example: queen from e6 to e1).

2. A function-palette diagram of the program shows the relationship between blocks and their interactions.

The board is designed using the array initialization, and the coins are placed in their default position. When the coin is moved, sub VI highlights only those positions that are valid for the coin to be moved; it doesn’t accept invalid positions. Once the move is made, the “current move” text field changes and shows which player has to move. Each sub VI decides the color of the coin and the square, and possible steps of the coin from each of its locations.

The quadrants are set after the initialization of the matrix. Each time the information from a coin is taken or moved, the previous and the present quadrant values are taken, as seen in the function palette diagram. Variables X and Y are the present coordinates of the coin on the board; then the future coordinates (the places it can move) are decided.

If the square already has a coin in it, it will be replaced by the new coin. The same concept is used for killing or removing any coins. A player can move any coin even if the king is in check, while the screen shows the king is in check in the text field. Even though this program is simulating a game, it can trigger creative and intelligent thinking in humans, and can promote the development of additional user-friendly and widely acceptable simulations for many applications, including robotics.

Download this article in .PDF format
This file type includes high resolution graphics and schematics when applicable.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.