pyagar.client
¶
This module contains the Client class.
pyagar.cmdline
¶
Provides the cmdline facility.
pyagar.controller
¶
Some very simple bots.
-
class
pyagar.control.
Controller
(client)[source]¶ All bots should inherit from this class.
-
edible
¶ You can eat cells 10% smaller than you.
-
opponents
¶ Return list of other cells.
-
player
¶ Returns the player main cell. None if not exists.
-
predators
¶ Cells that can eat me.
-
viruses
¶ Returns a list of visible viruses.
-
-
class
pyagar.control.
EatWhenNoPredators
(client)[source]¶ Only eats when all visible cells are smaller then itself.
pyagar.log
Contains the logger.
pyagar.messages
¶
Protocol implementation.
-
class
pyagar.messages.
BaseMSG
(buf, offset=0)[source]¶ All messages inherits from this class.
Contains utility methods for unpack the data.
-
class
pyagar.messages.
Camera
(x, y, zoom)¶ -
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
zoom
¶ Alias for field number 2
-
-
class
pyagar.messages.
CameraPosition
(buf, offset=0)[source]¶ Change in the camera position and/or the zoom.
Only received in
Spectate
mode.
-
class
pyagar.messages.
Cell
(id, x, y, size, color, is_virus, name)¶ -
color
¶ Alias for field number 4
-
id
¶ Alias for field number 0
-
is_virus
¶ Alias for field number 5
-
name
¶ Alias for field number 6
-
size
¶ Alias for field number 3
-
x
¶ Alias for field number 1
-
y
¶ Alias for field number 2
-
-
class
pyagar.messages.
Eat
(eater, eatee)¶ -
eatee
¶ Alias for field number 1
-
eater
¶ Alias for field number 0
-
-
class
pyagar.messages.
Leaderboard
(buf, offset=0)[source]¶ The
Leaderboard
.The top bigger cells in descending order.
This message is only received in
FFA
andExperimental
mode.
-
class
pyagar.messages.
MSG
(buf, offset=0)[source]¶ All messages.
This class identify the specific message type and calls the proper parser.
-
class
pyagar.messages.
MSGType
[source]¶ This enum contains the identifier of each message along with the name of the class which parses it.
-
cls
¶ Returns the parser class of this enum.
-
-
class
pyagar.messages.
ResetSomething
(buf, offset=0)[source]¶ This message is present in the code but never seen.
-
class
pyagar.messages.
Screen
(x1, y1, x2, y2)¶ -
x1
¶ Alias for field number 0
-
x2
¶ Alias for field number 2
-
y1
¶ Alias for field number 1
-
y2
¶ Alias for field number 3
-
-
class
pyagar.messages.
ScreenAndCamera
(buf, offset=0)[source]¶ Screen and Camera position, all in one.
This message is the first message in the stream.
-
class
pyagar.messages.
SetQARA
(buf, offset=0)[source]¶ This message is present in the code but never seen.
pyagar.utils
¶
Non categorized stuff.
-
class
pyagar.utils.
GameplaySaver
(filename)[source]¶ Store the gameplay messages in a file with a timestamp.
pyagar.visual
¶
Provides the default visualizer.
-
class
pyagar.visual.
Visualizer
(client, view_only=False, hardware=True)[source]¶ SDL based visualizer.
-
refresh
()[source]¶ Draw the current status of the game in
window
.The overall process is:
- The server send information about the board size and status.
1.1. We keep the information about the board in
gamescreen
.- We draw the game in the texture
stage
. This texture can be smaller thangamescreen
. - The rectangle
camera
(in game coordinates) is copied fromstage
towindow
.
-
stage
= None¶ The texture we draw to.
-
window
= None¶ The window where we show the game.
-