Table of Contents

I. Clines MAN page
clines - Console Lines Game

Clines MAN page


Table of Contents

clines - Console Lines Game

Name

clines — Console Lines Game

Synopsis

clines [-hlv] [-wN] [-tN] [-cN] [-iN] [-CS] [-fS] [-FS] [[-mb] | [-mc]] [-nN] [-NN] [-oC]

Description

CLines is a console puzzle game.

Game Rules

The game runs on a rectangular board, with evenly distributed cells. By default, the board consists of 9 by 9 cells. Every cell can be either empty or occupied by a chip. At the start of the game, a fixed number of chips (3 by default) is randomly thrown on the board. The turn is then given to the player. Every turn, player has to select a chip and move it onto a free cell on the board, and there has to be an unobscured path between the selected chip and the selected empty cell, having the chip only moving vertically or horizontally. After the player's turn, the whole board is scanned to determine if any chips of the same color form a long enough straight line (by default 5 chips), then all such chips are removed from the board. When the chips are considered for removal, a single chip may be a part of one or more straight lines. If at least one chip was removed, the control is immediately returned to the player. Otherwise the computer then makes it's turn, throwing more chips on the board (again, 3 by default). Then the board is again checked for any lines of chips to remove, before returning the turn to the player. The objective of the game is to prevent the board from filling up completely for as long as possible. The game ends when computer doesn't have enough room to place all chips for it's move.

Scoring

Anytime chips are removed from the board, the players receives points. There is a minimum limit of chips required to be in a line to be removed at all (5 by default). The points are awarded, whether the chips are removed after the player's or computer's move. For every expelled chip, up to the minimum amount, one point is awarded. If more than minimum amount of chips were removed, then player gets additional points, as many as there are chips removed, multiplied by the amount of the extra chips removed. If the player is successful in removing any chips for two or more turns consecutively, additional points also awarded, in the amount of such moves minus one, squared. So, the total amount of awarded points is:

b * b + n * (n - min)

Where

  • min is the minimum elements in a line

  • n is the amount of chips being removed this turn

  • b is the award for consecutive scoring (0 for first turn, 1 for second, etc.).

In other words, it's better to remove chips in consecutive turns, without letting computer to take it's turn, and it's really sweet to remove large clusters of chips. The most usual example of a larger cluster is to either have a very long straight line, or to have one or more lines join at a single cell, where the chip is placed last, like building a letter V, filling in the bottom tip in the very end.

If so compiled and configured, the game will save it's high score for every user who plays the game. The top high score is displayed below the game board. Players score are always displayed in the left top corner, if any. When the game ends, the players latest score is saved as a personal record, if beaten. If the game's confiugration is changed from the defaults (one of wtcinN options specified with a non-default value), the high score function is disabled. The record score is saved when the game stops because player looses the game, or player decides quits the game (including stopping the game with SIGQUIT or SIGINT signals).

Game Control

The game is controlled with the keyboard or mouse, if your curses library has mouse support (or running on some UNIX(tm) console with running gpm). If you see the mouse cursor, that may not mean that the game can be controlled with the mouse. To determine if it can be, move your mouse pointer over the middle of any empty cell on the board, and click left mouse button. If the text cursor dissapears, you can control the game with the mouse. With the mouse, the interface is simple, point and click on the chip you would like to move, then click on another chip to change you mind, on the same chip to clear the selection, or to an empty cell to move the chip. If the selected empty cell has no unobscured path from the cell with the selected chip is, the game will beep (depending on your curses library, terminal, and audio device support), and the chip will remain selected. Selected chip is "jumping" in it's cell. With keyboard, by default, the keyboard arrow buttons should move the cursor around. Space bar either selects a chip, clears the current selection, or moves currently selected chip to an unoccupied cell. Attempt to select a chip when another chip is already selected simply changes the currently selected chip. The cursor arrows are duplicated with h to move left, l to move right, k to move up, and j to move down. The key q stops the program.

Options

Various options can be passed to the game program to modify the conditions of the game, or it's presentation.

-h

A short help message is displayed, and program terminates.

-l

Currently record high scores are displayed, and program terminates.

-v

Version information is displayed, and program terminates.

-w <number>

Specify board width (default is is 9).

Since both -t and -w options change the size of the board, it can be displayed differently on your terminal. It's possible your terminal would have not enough width or height to display the board, in which case an error message will be displayed. If the terminal is resized during the gameplay, the board will be redisplayed, unless it doesn't fit into the new terminal size. In this case a corresponding message will be displayed, and game will not resume until the terminal is resized properly. If only one character can be used to display a cell, game work in the "mini mode", which changes how the chips behave when they are selected.

-t <number>

Specify board height (default is 9).

-c <number>

Specify how many colors to use (default is 5).

Note that most commonly used terminals have limit on how many colors they can define and display distinctly. Specifying too large value here may lead to an error message if the colors can not be allocated, or may result in chips of different colors to look the same to the user. If the game runs in black and way mode, and the specifed value is over the default, then the -F option must also be specified to provide a custom font.

-i <number>

Specify the minimum number of chips that can be removed if aligned in a straight line (default is 5). Now, setting this value to anything that is larger than width or height of the board will effectively make it impossible to score any points.

-C <string>

Specify the characters to be used to perform the game actions in the order of LEFT, DOWN, UP, RIGHT, ACTION. The default is "hjkl ". The behavior of the character q can be overwritten by this option, in which case use Ctrl-C or Ctrl-\ to quit the game.

-f <string>

Specify color "font". The specified string should be three characters long. First character is used to draw cursor, second character is used to draw the chips, and the third is used to draw selected chips in the mini mode. The default is "IOo". This option is ignored in black and white mode.

-F <string>

Specify black and white "font". The first character in the specified string is used to draw the cursor. The rest of the string specify characters to use for each different "color" of the chip. One character for regular display, another for displaying jumping chip in the mini mode. The default is "*OoVvAa.'Zz". This option is ignored in the color mode. There should be enough character for the specified number of various chips. This option has to be specified if -c option was specified and has a value larger than the default.

-n <string>

Specify how many chips appear after every computer turn, except for the initial turn. Default is 3.

-N <number>

Specify how many chips to appear before player's first move. Default is 3. This has to be at least 1.

-o <colors>

Specify comma separated color numbers to use for chips and cursor, in color mode only. By default it's 7,1,2,3,4,5. The first color is always for the cursor. The rest are for chips. If the amount of various chips is changed through -c option, then, by default, the colors are assigned to the chips in the same manner: white (7) assigned for the cursor, and then consecutive colors, starting from 1 and up are assigned to the chips, skipping over white color.

-m {c|b}

Force color or black and white mode. The color mode can not be forced if corresponding curses functions indicate the terminal is color blind.