# &app; Manual V&manrevision;

## Introduction

&app;, or Rhino its former name, is a reversi game. What distinguishes &app; from most other reversi games is that &app; will be targeted for experienced reversi players. Strong AI is the main focus with some additional good, useful features is planned. The ultimate target strength of the AI is that it should be able to beat the best human player at the highest difficulty level.

## Getting Started

You can start &app; from a command line by typing the following command, then press Return:

`grhino`

When you start &app;, a window similar to the following is displayed. This figure shows the window using small theme, with board border and toolbar turned on. The actual display varies depending on Preferences settings.

### &app; Start Up Window

Shows &app; main window. Contains title bar, menubar, board border, game board, and statusbar.

The &app; window contains the following elements:

Menubar.

- The menus on the menubar contain all of the commands you can use in &app;.

Toolbar.

- The toolbar contains a subset of the commands that you can access from the menubar. This can be turned on and off via the View Toolbar menu.

  You can right click on the empty area of the toolbar to select if text and icons of the buttons are displayed. Furthermore, the size of icons on the toolbar can be chosen in the Preferences dialog box opened by Settings Preferences menu. The relevant setting is the Toolbar icon size configuration in the Theme tab.

Board Border.

- This can be turned on and off using Show board border setting in the Theme tab in the Preferences dialog.

Game Board.

- This is the place where the game is played. Simply clicked on a square to place your move.

  In certain game mode, such as in backward or forward through the game history, the mouse cursor changes from arrow to other symbols when you move the mouse over game board and border. You need to exit that mode first to continue playing.

  The board graphics may be changed via the Theme directory setting in the Theme preferences tab. &app; comes with a default board and another board using small graphics.

Statusbar.

- The information here varies depending on the game status. When the game is in progress, the current player shown. When the game ends, the scores are displayed.

Throughout this manual, various actions are described using commands from the menubar. You can simply click on the corresponding button in the toolbar to achieve the same result.

## Playing GRhino

This section describes game playing with &app;. The rules of reversi are not provided here but you can find those kinds of information from the Internet. Strategy guide to help beating &app; can be found at Links section of GRhino web page.

### Basics

To start a new game, choose Game New game menu command. By default, the game starts from the beginning. You may choose to start from any opening by setting Opening option in the Board tab of Preferences dialog box. This is a good way to learn different reversi openings. The name of the opening, when matches the current board position, is displayed inside a pair of bracket "[...]" in the statusbar.

To choose the computer player, use the Computer player option in the AI tab of Preferences dialog box. You can quickly change the computer color between black and white using Settings Switch computer color menu.

After the game has been started, click on the board square to place a move. If the move is valid, a disc appears and captured pieces are flipped. AI's move is placed immediately without user involvement. Similar applies when a player has to pass, the other player just makes consecutive moves. At higher AI level, AI may take a long time before placing a move. You can see whose turn it is by looking at the statusbar at the bottom of the window.

When the game ends, the final score is displayed on the statusbar. You can start another game by via Game New game menu.

During the game, you may undo your move using Edit Undo move menu. If you decide to repeat the previous move, the Edit Redo move menu is available. The number of times you can undo is unlimited. Depending on the Redo also repeat same AI moves setting in the Board tab in the Preferences dialog, the AI may choose a different move from the previously made one before undo.

### Game History

You may look at different stages of the current game by using the following menu commands:

Edit Previous move

- View board position of the previous move regardless of whether the player is human or computer. Repeatly use this command to go backward through the game history.

Edit Next move

- View board position of the next move regardless of whether the player is human or computer. Repeatly use this command to go forward through the game history.

Edit Begin of game

- Jump to the initial board position of the game.

Edit Last move

- Jump to the last board position of the game. This allows the game to continue.

Although these commands are similar to undo and redo, they do not affect the current game. You can go backward and forward as many time as you want.

When you want to continue the current game, simply use the Edit Last move command to show the last board position. The mouse cursor, when move on the game board, shows "X" symbol instead of the usual arrow as a reminder when the board does not show the last position.

Another convenient way to navigate through game history is via the Game History window. It can be opened via View Game history... menu.

#### Game History Window

Shows Game History window.

Three columns are displayed in the window: move number, player, and position. Click on any row to display board position as the result of that move. Pressing Up, Down, Page Up, Page Down, Home, and End there also works.

### Saved Games

Currently GRhino supports IOS and GGS game formats. Game files can be opened using the menu Game Open .

If the game file contains one game, the game is displayed on the board immediatly. Then you can use various commands in the Edit menu to navigate through the game. If multiple games exist in the file, the Game List window opens. Click on a row to bring the game to the board.

#### Game List Window

Shows Game List window.

Five columns are displayed: game number, black player name, white player name, game type, and result of the game. In the Type column, Std indicates standard game, i.e., game starts from initial position, while Rand indicates random game with the specified number of pieces on the board. The format of the Result column varies depending on the file format.

You can sort the games by clicking on any column header. By default, games are sorted in the order that appear in the file.

### Editing board

You can start a game from arbitrary board position by using Edit board feature. It can be accessed from the menu Game Edit board .

This feature only works when Toolbar is displayed. If not, select the menu View Toolbar to activate the toolbar.

When inside editing mode, an additional toolbar appears as seen in the below figure.

#### Game Window

Game window showing edit toolbar.

The first three buttons select the color to place on the board: empty, black, and white. You can place them on the board by clicking on the desired position. You can place a rectangular block by dragging on the board similar to drawing a rectangle in a paint program. The fourth button select the player who will have the first move when the game begins. The last button accept the edit and start game from the current board.

Mouse shortcuts are provided in this mode. Right clicking cycles through the three colors: empty, black, and white. Middle clicking alternate the player to start game.

### AI Implementation

The current &app; AI is based on open book, pattern and parity-based evaluator, and final disk count. The choice depends on the stage of the game. All parameters related to AI can be found in the AI tab of the Preferences dialog.

During begining of the game, an open book is used. The chosen move is based on move popularity of IOS and GGS game database. It is controlled by the parameter Open book variation. There are 6 possible values: None, Very low, Low, Medium, High, and Very high. &app; always uses the same opening with the None option while more choices of moves are made with higher settings.

During mid game, a pattern-based evaluator is used. The pattern was trained from IOS and GGS games using win-loss percentage as a score. There is also score adjustment based on parity situation on the board. The difficulty depends on the search depth. The deeper search, the stronger the AI.

&app; also relies on searching during end game. But disk count score is used instead. The setting Winning move search empties determines when to look for a move that guarantee a win for computer and places moves based on the search result. This is also known as win-loss-draw search. On the other hand, Perfect end game search empties controls when to search for a move that maximize computer's score. Searching earlier in the game when there are plenty of empty squares (or simply empties) produces better AI play.

Usually winning play search is a lot faster than perfect search, so Winning move search empties can be set a few empties higher than Perfect end game search empties. When Winning move search empties is set to less than Perfect end game search empties, winning move search is disabled altogether.

There are 5 default levels of difficulty available during mid to end game where AI parameters are fixed. They are set according to the table below. The AI parameters can be changed freely in the custom level.

### AI Default Parameters

Setting | Level
1 | 2 | 3 | 4 | 5
Mid game search depth | 2 | 4 | 6 | 8 | 10
Winning move search empties | 6 | 8 | 12 | 16 | 20
Perfect end game search empties | 4 | 6 | 10 | 14 | 18

Currently, a search tree pruning is not yet implemented. So playing AI level 5 is not practical.

### Pattern Evaluation Window

You can view the score of current board position without move look ahead from the Pattern Evaluation window. This can be opened via View Pattern evaluation... menu. The score used during mid game is the Total score but from searching all possible future moves up to the specified mid game search depth. Although it is intended for AI development and debugging, this provides an idea of what AI thinks about the current board position. These information, however, is AI implementation dependent and may change in future version of &app;.

#### Pattern Evaluation Window

Shows Pattern Evaluation window.

The main part of window is a table listing all different patterns used by &app; and its score. They are simply summed together and added with Parity score to produce the Total score for AI. Positive score means black has an advantage while negative score favors white.

Parity score is the AI idea of current parity situation. This is very important toward the end of the game as the player who can play the last move of any hole can flip a lot of pieces that are never flipped back again.

Move index represents just the stage of the game. The AI uses different pattern tables at different game stages.

## Settings

To configure &app;, choose Settings Preferences . The Preferences dialog contains the following tabbed sections:

- grhino-prefs-ai

- grhino-prefs-board

- grhino-prefs-theme

Note that the changed settings only last until you exit from &app;. To make them apply to all future sessions, use the Settings Save settings menu. In UNIX systems, the configurations is stored in the file `~/.gnome2/GRhino`.

### AI

#### Preferences Dialog - AI Tab

Shows &app; AI tab of Preferences window.

Computer player

- Select the color of the AI player. You can have AI playing against itself by setting this to Both. The AI player can be changed automatically in each new game when it is set to Alternate or Random.

Computer level

- This setting provides an easy control for various other AI options below to a predefined value. Due to some flaws in the current AI, the AI strength appears to peak at some point and does not increase with the level settings is higher.

Mid game search depth

- This controls the number of lookahead move the AI search is performed during the mid game stage. During this stage, the AI evaluates the position using pattern and parity score. It can be configured only when the option Computer level is set as Custom.

Winning move search empties

- This controls when to use winning move search instead of mid game search. This search is started if the number of empty squares on the board reach the specified number. The AI tries to find a move that always results in a win for AI and terminates the search if one is found. It can be configured only when the option Computer level is Custom.

Perfect end game search empties

- This controls when to use perfect end game search. The AI evaluates the board using final disk counts as search criterion. It can be configured only when the option Computer level is Custom.

Randomness

- It adds the amount of randomness to board scores during mid game and end game search.

Open book variation

- It effects AI during opening stage of the game. The open book is based on move popularity. With None, the AI plays the same opening every game, with the most popular moves always chosen. For higher settings, the choice of openings becomes more varied. But the strength of AI is weaken if the setting is too high.

### Board

#### Preferences Dialog - Board Tab

Shows &app; Board tab of Preferences window.

Log game moves

- If checked, all games played are logged into the file `~/grhino.log`. It is a GGS format and can be opened by Game Open menu, processed by `gen_book` and `gen_pattern` programs.

Redo also repeat same AI moves

- If checked, when using redo command AI always makes the same moves as the original game sequence. Setting this option on has an advantage that game may be undo several times and then redo as many times to get back to the last board position. Otherwise AI may choose to try an alternative position thus making further redo impossible.

Animate opening

- This controls whether the game should animate the opening moves for the selected Opening option below.

Animation delay

- This controls how much delay before computer makes a move, the larger number the longer delay. The unit is 0.1 second. This is useful when Animate opening is selected.

Start game from

- This selects the board when you start a new game. Initial board starts the game with the standard four disc in the center of the board. Random board starts the game with pieces randomly placed, beginning from center of the board, with equal number of pieces for black and white. When playing with computer, AI open book is disabled with Random board.

Opening

- This allows you to play games beginning from a particular opening instead of the default &app; open book. The openings are taken from Robert Gatliff opening list July 15, 1995 version. This option only applies when Start game from is Initial board.

Random game pieces

- This chooses the number pieces on the board when Start game from is Random board.

### Theme

#### Preferences Dialog - Theme Tab

Shows &app; Theme tab of Preferences window.

Show possible moves

- When selected, all possible move is shown as small dots on the game board.

Show last move

- When selected, the disk placed in the previous move is shown together with a small cross.

Show board border

- When selected, graphics for board borders are also shown. The actual content depends on the theme chosen. For themes coming with &app;, labels indicating board position are displayed.

Theme directory

- This chooses the set of board graphics used by &app;. The DEFAULT option selects the images compiled into &app; binary. Other choices correspond to image files stored in the specified subdirectory inside the &app; `theme` directory. By default this is `/usr/local/share/grhino-0.16.1/theme`. New themes may be added by creating image files named `black, white, empty, hint_black, hint_white, black_last, white_last, left, right, top`, and `bottom` with either `.png` or `.xpm` extension and placing them inside a new subdirectory of `theme`.

Toolbar icon size

- This control the size of icons in the toolbar when it is visible.

## About &app;

&app; was written by Kriang Lerdsuwanakij (lerdsuwa@users.sourceforge.net). To find more information about &app;, please visit the GRhino Web page.

To report a bug or make a suggestion regarding the &app; or this manual, please use the &app; bug tracker at the &app; web page.

This program is distributed under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license can be found at this link, or in the file COPYING included with the source code of this program.