Test task Idea Four in a row

Продолжаем публикацию примеров выполнения тестовых заданий для выявления наиболее оптимальных способов решения тех или иных задач. Данное тестовое задание было выполнено моим хорошим другом odin.sergius и любзно предоставлено мне для публикации. Пример выполнения задания можно скачать здесь.

Four in a row (to be developed in Borland Delphi, any version)

Requirements:

for in row

Fig. 1: Example of a “Four in a row” game board

Fig. 1: Example of a “Four in a row” game board

  • The main window of the application shows the game board for playing a game of four in a row. It contains 7 columns and 6 rows. The game board is initially empty.
  • The aim is that 2 players can play, each in turn, by dropping a coin at the top of a column. Each player will have his/her own coin color (for example: player 1 red, player 2 yellow)
  • There’s no need to be able to play against the computer
  • The main window should show clearly which player’s turn it is and which color he/she plays with
  • When 1 of the 2 players has 4 coins in a row (either horizontally, vertically of diagonally) he/she won the game and this should be shown by a message to the players. The game then ends.
  • A new game can be started by clicking the “New Game” menu item in the File menu of the application (it must be possible to restart the game while it is still going on, for example when all places are filled with coins)
  • The application can be ended by clicking the “Exit” menu item in the File menu (or by using the standard Windows GUI elements, e.g. close button of the window)

Important!

  • This is not an exercise in graphical programming. There’s no need to develop a fancy looking game board (although it is not forbidden of course…), as long as the game works like it should it is ok.
  • Code is judged by used coding style, classes, algorithms, creativity etc. So make sure the code is structured as well as possible.

Good luck.

Share

Tags: , ,

Leave a Reply