Bots #23
@ -6,6 +6,12 @@ looking for opponents, or in games when it is one's turn.
|
|||||||
|
|
||||||
https://user-images.githubusercontent.com/25559600/221317658-a80046ca-6009-456d-b43c-67d95baa4bf6.mp4
|
https://user-images.githubusercontent.com/25559600/221317658-a80046ca-6009-456d-b43c-67d95baa4bf6.mp4
|
||||||
|
|
||||||
|
## Bots
|
||||||
|
As a user, you can create 2 bot accounts at [/bots](https://chessh.linux.usu.edu/bots). These are driven by
|
||||||
|
webhooks.
|
||||||
|
|
||||||
|
For an example bot, see [chessh example bot](https://github.com/Simponic/chessh_bot).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
@ -19,7 +19,7 @@ config :chessh, RateLimits,
|
|||||||
discord_notification_rate: 30,
|
discord_notification_rate: 30,
|
||||||
discord_notification_rate_ms: 1000,
|
discord_notification_rate_ms: 1000,
|
||||||
bot_redrive_rate: 1,
|
bot_redrive_rate: 1,
|
||||||
bot_redrive_rate_ms: 60_000
|
bot_redrive_rate_ms: 30_000
|
||||||
|
|
||||||
config :chessh, Web,
|
config :chessh, Web,
|
||||||
discord_oauth_login_url: "https://discord.com/api/oauth2/token",
|
discord_oauth_login_url: "https://discord.com/api/oauth2/token",
|
||||||
|
@ -37,7 +37,6 @@ defmodule Chessh.Bot do
|
|||||||
bot: %Chessh.Bot{id: bot_id, name: bot_name},
|
bot: %Chessh.Bot{id: bot_id, name: bot_name},
|
||||||
fen: fen,
|
fen: fen,
|
||||||
turn: turn,
|
turn: turn,
|
||||||
last_move: last_move,
|
|
||||||
status: status,
|
status: status,
|
||||||
light_player_id: light_player_id,
|
light_player_id: light_player_id,
|
||||||
dark_player_id: dark_player_id
|
dark_player_id: dark_player_id
|
||||||
@ -50,7 +49,6 @@ defmodule Chessh.Bot do
|
|||||||
turn: Atom.to_string(turn),
|
turn: Atom.to_string(turn),
|
||||||
bot_turn:
|
bot_turn:
|
||||||
(is_nil(light_player_id) && turn == :light) || (is_nil(dark_player_id) && turn == :dark),
|
(is_nil(light_player_id) && turn == :light) || (is_nil(dark_player_id) && turn == :dark),
|
||||||
last_move: last_move,
|
|
||||||
status: Atom.to_string(status)
|
status: Atom.to_string(status)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -10,10 +10,11 @@ defmodule Chessh.SSH.Client.Game.Renderer do
|
|||||||
@tile_width 7
|
@tile_width 7
|
||||||
@tile_height 4
|
@tile_height 4
|
||||||
|
|
||||||
@previous_move_background ANSI.light_magenta_background()
|
@previous_move_background ANSI.color_background(208)
|
||||||
@from_select_background ANSI.light_green_background()
|
@from_select_background ANSI.color_background(105)
|
||||||
@to_select_background ANSI.light_yellow_background()
|
|
||||||
@in_check_color ANSI.yellow_background()
|
@to_select_background ANSI.color_background(177)
|
||||||
|
@in_check_color ANSI.color_background(197)
|
||||||
|
|
||||||
@dark_piece_color ANSI.red()
|
@dark_piece_color ANSI.red()
|
||||||
@light_piece_color ANSI.light_cyan()
|
@light_piece_color ANSI.light_cyan()
|
||||||
|
@ -106,6 +106,8 @@ defmodule Chessh.SSH.Client.SelectBot do
|
|||||||
)
|
)
|
||||||
|> Repo.insert()
|
|> Repo.insert()
|
||||||
|
|
||||||
|
spawn(fn -> Bot.send_update(game |> Repo.preload([:bot])) end)
|
||||||
|
|
||||||
{Chessh.SSH.Client.Game,
|
{Chessh.SSH.Client.Game,
|
||||||
%Chessh.SSH.Client.Game.State{player_session: player_session, color: color, game: game}}
|
%Chessh.SSH.Client.Game.State{player_session: player_session, color: color, game: game}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user