![]() |
Bridges-Python
3.2.0
Bridges(PythonAPI)
|
This is the base class for all games in BRIDGES.
Public Member Functions | |
| def | __init__ (self, assid, login, apikey, rows, cols) |
| PROTECTED constructor prevents the object from being directly created. More... | |
| def | game_base_init (self, id, log, key, rows, cols) |
| Initializes the gamebase object. More... | |
| def | close (self) |
| close the socket connection (and game) More... | |
| def | register_keypress (self, kl) |
| def | start (self) |
| "starts the game. Called once at the beginning" More... | |
| def | initialize (self) |
| "Game initialization. . Called once at the beginning" More... | |
| def | game_loop (self) |
| "Method contains all of the game logica and can call other user defined methods" More... | |
| def | quit (self) |
| calling this function causes the game to end. More... | |
| def | set_title (self, title) |
| sets title of game More... | |
| def | set_description (self, desc) |
| sets description of the game More... | |
| def | get_bg_color (self, row, col) |
| gets background color of a cell More... | |
| def | set_bg_color (self, row, col, color) |
| sets background color of a cell More... | |
| def | get_symbol (self, row, col) |
| gets symbol of the cell at row, col More... | |
| def | get_symbol_color (self, row, col) |
| gets symbol color of the cell at row, col More... | |
| def | draw_symbol (self, row, col, s, c) |
| draw symbol s with color col at cell (row, col) More... | |
| def | render (self) |
| renders the board More... | |
| def | board_width (self) |
| setter/getter property for board width More... | |
| def | board_height (self) |
| setter/getter property for board height More... | |
Public Attributes | |
| grid_state | |
| firsttime | |
| bridges | |
| grid | |
| sock | |
| game_started | |
Static Public Attributes | |
| bool | debug = True |
| def bridges.gamebase.GameBase.__init__ | ( | self, | |
| assid, | |||
| login, | |||
| apikey, | |||
| rows, | |||
| cols | |||
| ) |
PROTECTED constructor prevents the object from being directly created.
Since GameBase is meant to be a purely internal class, that seems appropriate.
| assid | assignment number |
| login | user name |
| apikey | authentication id |
| rows | height of game grid |
| cols | width of game grid |
| def bridges.gamebase.GameBase.board_height | ( | self | ) |
setter/getter property for board height
| def bridges.gamebase.GameBase.board_width | ( | self | ) |
setter/getter property for board width
| def bridges.gamebase.GameBase.close | ( | self | ) |
close the socket connection (and game)
| def bridges.gamebase.GameBase.draw_symbol | ( | self, | |
| row, | |||
| col, | |||
| s, | |||
| c | |||
| ) |
draw symbol s with color col at cell (row, col)
| row | the row of the cell |
| col | the column of the cell |
| s | symbol |
| c | color |
| def bridges.gamebase.GameBase.game_base_init | ( | self, | |
| id, | |||
| log, | |||
| key, | |||
| rows, | |||
| cols | |||
| ) |
Initializes the gamebase object.
| id | assignment number |
| log | user name |
| key | authentication id |
| rows | height of game grid |
| cols | width of game grid |
| def bridges.gamebase.GameBase.game_loop | ( | self | ) |
"Method contains all of the game logica and can call other user defined methods"
| def bridges.gamebase.GameBase.get_bg_color | ( | self, | |
| row, | |||
| col | |||
| ) |
gets background color of a cell
| row | the row of the cell |
| col | the column of the cell |
| def bridges.gamebase.GameBase.get_symbol | ( | self, | |
| row, | |||
| col | |||
| ) |
gets symbol of the cell at row, col
| row | the row of the cell |
| col | the column of the cell |
| def bridges.gamebase.GameBase.get_symbol_color | ( | self, | |
| row, | |||
| col | |||
| ) |
gets symbol color of the cell at row, col
| row | the row of the cell |
| col | the column of the cell |
| def bridges.gamebase.GameBase.initialize | ( | self | ) |
"Game initialization. . Called once at the beginning"
| def bridges.gamebase.GameBase.quit | ( | self | ) |
calling this function causes the game to end.
| def bridges.gamebase.GameBase.register_keypress | ( | self, | |
| kl | |||
| ) |
| def bridges.gamebase.GameBase.render | ( | self | ) |
renders the board
| def bridges.gamebase.GameBase.set_bg_color | ( | self, | |
| row, | |||
| col, | |||
| color | |||
| ) |
sets background color of a cell
| row | the row of the cell |
| col | the column of the cell |
| color | color to be set |
| def bridges.gamebase.GameBase.set_description | ( | self, | |
| desc | |||
| ) |
sets description of the game
| def bridges.gamebase.GameBase.set_title | ( | self, | |
| title | |||
| ) |
sets title of game
| def bridges.gamebase.GameBase.start | ( | self | ) |
"starts the game. Called once at the beginning"
| bridges.gamebase.GameBase.bridges |
|
static |
| bridges.gamebase.GameBase.firsttime |
| bridges.gamebase.GameBase.game_started |
| bridges.gamebase.GameBase.grid |
| bridges.gamebase.GameBase.grid_state |
| bridges.gamebase.GameBase.sock |
1.8.13