---
name: "ggtlai"
section: "3"
platform: "linux"
package: "libggtl2-dev"
version: "2.1.4-2"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/ggtlai"
---

# ggtlai(3)

the various AIs supported by GGTL

## NAME

ggtlai - the various AIs supported by GGTL

## SYNOPSIS

```
  #include <ggtl/core.h>

  /* set the current AI type */
  ggtl_set(g, TYPE, X);
  /* get the current AI */
  ggtl_get(g, TYPE);
  /* force a move */
  ggtl_move(g, m);
  /* make the current AI perform a move */
  ggtl_ai_move(g);
```

## DESCRIPTION

GGTL supports a few different modes for the AI player. The various AIs can be chosen by calling `"ggtl_set(g, TYPE,` `<type>)"`. The accepted `"type"`s are:

- NONE

  Not really an AI. Always picks the first move returned by the *get\_moves()* callback. Can be useful for testing.

- RANDOM

  Not really an AI either. Picks one of the available moves at random. It is the responsibility of the user to call *srand()* to make sure the random generator is seeded differently for each run.

- FIXED

  Performs a fixed-depth Alpha-Beta search to find the best move at a given ply (depth in the game tree). The depth to be searched can be set with `"ggtl_set(g, PLY, depth)"`.

- ITERATIVE

  This AI performs an iterative deepening Alpha-Beta search to find the best possible move at the greatest depth that can be searched in a given time. The time allowed for a search can be set with `"ggtl_set()"`; use `"ggtl_set(g, TIME, 0.350)"` to set the allowed time to 350 milliseconds.

## SEE ALSO

[*ggtl*(3)](/ggtl/3.md)

## AUTHOR

Stig Brautaset \<stig@brautaset.org\>

## COPYRIGHT

Copyright (C) 2005-2006 Stig Brautaset

This program is free software; you can redistribute it and/or modify it 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.
