> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-poker/house-players.md).

# House players

CAS Poker house players: NPC gamblers who fill empty seats so one player can start a game. How they sit down, decide and leave, their four styles, and how to turn them off.

Hold'em needs at least two players with chips. House players are NPC gamblers, the story mode's card players, who take empty seats so a single player can start a game at any table. Everyone around the table sees them sit, deal, bet, fold and rake in pots with the same animations as the players.

## How they fill the seats

* They only come to a table where at least one real player sits, and only between hands.
* They sit down one at a time, a second and a half apart, until the table holds `fillTo` players (real players and house players together, 4 by default) or `maxBots` house players (3 by default). A lone player therefore plays against three house players.
* Each one takes a free seat at random, with a name from `names` (no two of the same name at one table), a style from `styles`, a ped model from `models` and one of its `outfits`.
* Each one sits down with `stackShare` of the table's maximum buy-in: $30 at `low`, $120 at `medium` and $600 at `high` with the defaults.

House players never fill the table past `fillTo`, so with the defaults a table always has free seats for real players when it starts. House players who are already seated do not stand up on their own when more real players sit down, but a player can ask for a house player's chair (see [Asking for the seat](/script-documentation/cas-poker/house-players.md#asking-for-the-seat)). To keep more seats open for real players, lower `fillTo` or `maxBots`.

## When they leave

A house player stands up between hands when:

* a player asked for its chair (see [Asking for the seat](/script-documentation/cas-poker/house-players.md#asking-for-the-seat)),
* it runs out of chips (house players do not buy more; another one may take a seat 30 seconds later while the table is below `fillTo`),
* no real player is left at the table,
* the house players are turned off (see [Turning them off](/script-documentation/cas-poker/house-players.md#turning-them-off)).

If a house player takes the chair you picked while you are still choosing your stake on the buy-in panel, you get the message "A house player will make room after this hand". A house player stands up when the hand is over and you can sit down again.

## Asking for the seat

Walk up to a chair a house player sits in and the prompt reads **Ask for the Seat** instead of **Sit Down**. It uses the same key (hold **E**) and the same range (`Config.SitDistance`). When a free chair is about as close as a house player's chair, the free chair's **Sit Down** prompt is the one you get.

1. Hold **E**. You get the message "A house player will make room after this hand".
2. The house player stands up as soon as the hand being played is over, or at once when no hand is running.
3. For 30 seconds after it stands up, no new house player sits down at that table, so the chair stays free for you. The hold ends early as soon as a real player sits down at the table.
4. Hold **E** at the free chair for **Sit Down** and pick your stake on the buy-in panel as usual.

The prompt text is `prompt_ask_seat` in `config/locale.lua`.

## How they decide

House players only know what a player at their seat would know: their own two cards, the board, the bets and how many players are still in the hand. They never see anyone else's cards.

* **Before the flop** they score their two cards (high cards, pairs, suited and connected cards) and play fewer hands when more players are in.
* **From the flop on** they work out their real chance of winning: they play the rest of the hand out `samples` times (140 by default) against random cards for every player still in, and count how often they win.
* **Then they weigh it against the price.** A strong hand raises (half the pot, three quarters or the full pot) or, when it is very strong, sometimes goes all in. A hand that is worth the price of the call calls, a free check is taken, and the rest folds. Small calls of a big blind or less and calls with most of the stack already in the pot are made more easily.
* **They bluff now and then**, except on the river, more or less often by style.
* **They take their time.** Each decision takes about one to three seconds (times `thinkScale`), on top of the time the table needs to show the last move.

A little chance is mixed into every decision, so they are never fully predictable.

## Styles

Every house player gets one style, picked at random from the `styles` list. A style listed twice comes up twice as often, so with the default list `regular` is the most common.

| Style     | How it plays                                                | Bluffs         |
| --------- | ----------------------------------------------------------- | -------------- |
| `rock`    | Plays few hands and seldom raises.                          | Rarely (3%)    |
| `regular` | A steady player: plays fair hands and raises the good ones. | Sometimes (7%) |
| `gambler` | Plays more hands and raises the most.                       | Often (14%)    |
| `drunk`   | Plays the most hands, calls a lot and raises less.          | Most (20%)     |

The bluff share is the chance, on each decision before the river, that a house player of that style looks for a bluff raise.

## Settings

The house players are set in `Config.Bots` in `config/config.lua`:

```lua
Config.Bots = {
    enabled = true,
    fillTo = 4,
    maxBots = 3,
    stackShare = 0.6,
    samples = 140,
    thinkScale = 1.0,
    styles = { "rock", "regular", "regular", "gambler", "drunk" },
    names = {
        "Cornelius Brandt", "Ezra Pike", "Silas Whitlock", "Amos Thorne", "Jedediah Cole", "Calvin Rusk",
        "Otis Hartley", "Wendell Price", "Abner Quill", "Luther Graves", "Rufus Kincaid", "Virgil Stowe",
        "Elias Mercer", "Horace Dunn", "Thaddeus Vale", "Barnaby Locke",
    },
    models = { "A_M_M_CARDGAMEPLAYERS_01" },
    outfits = 12,
}
```

| Field        | Default | Meaning                                                                                                                                        |
| ------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `enabled`    | `true`  | `false` turns them off at every table. This is the setting that sticks: `/pokeradmin bots on\|off` only lasts until the next restart.          |
| `fillTo`     | `4`     | House players sit down until this many sit at the table, real players and house players together (at most six).                                |
| `maxBots`    | `3`     | The most house players at one table.                                                                                                           |
| `stackShare` | `0.6`   | The share of the table's maximum buy-in a house player sits down with.                                                                         |
| `samples`    | `140`   | How many times they play a hand out per decision after the flop. Higher plays a little stronger and costs a little more server time.           |
| `thinkScale` | `1.0`   | Their thinking time. `0.5` makes them act twice as fast, `2.0` twice as slow.                                                                  |
| `styles`     | list    | The styles above: `"rock"`, `"regular"`, `"gambler"`, `"drunk"`.                                                                               |
| `names`      | list    | The names they sit down under.                                                                                                                 |
| `models`     | list    | Ped models, one picked at random. `A_M_M_CARDGAMEPLAYERS_01` is the story mode's card player; add any ped model you like.                      |
| `outfits`    | `12`    | How many outfit presets to pick from. `A_M_M_CARDGAMEPLAYERS_01` has 12. When you add models, keep it at a number every model in the list has. |

One table can have its own fill with `botFillTo = 2` in its entry in `config/tables.lua`, or no house players at all with `bots = false`.

## Turning them off

* **Everywhere:** `Config.Bots.enabled = false`.
* **At one table:** `bots = false` in that table's entry in `config/tables.lua`.
* **Live, without a restart:** `/pokeradmin bots off` turns them off at every table. House players who are not in the hand being played stand up at once, the others as soon as that hand is over. `/pokeradmin bots on` brings them back. This lasts until the next restart: after a restart the setting in `config/config.lua` counts again, so set `Config.Bots.enabled` there to make it stick.

## House players and your economy

The chips of a house player belong to the house. They do not come from any player and they go to nobody when the house player stands up. So:

* **What a player wins from a house player is new money** in your economy.
* **What a house player wins from a player leaves your economy** when it stands up.

If you want tables where money only changes hands between players, turn the house players off there. Lower stakes or a smaller `stackShare` keep the amounts small.

## More

* [Buy CAS Poker](https://codeaftersex.com/script/poker)
* [Support Discord](https://discord.gg/codeaftersex)
* [All CodeAfterSex scripts](https://codeaftersex.com/scripts)
