Module player :: Class ComputerPlayer
[hide private]
[frames] | no frames]

Class ComputerPlayer

source code

                  object --+        
                           |        
pyglet.event.EventDispatcher --+    
                               |    
           cocos.layer.Layer --+    
                               |    
                          Player --+
                                   |
                                  ComputerPlayer

The premise of this AI is to use a FINITE STATE MACHINE to react "intelligently" to a human player. The states of this machine are defined below. An "N-Gram" will be used to collect data about player moves. The "A-Star" pathfinding algorithm will be employed to find the most efficient way to attack.

Instance Methods [hide private]
 
__init__(self, ID, gameMap, cm, color, enemy)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
scan(self) source code
 
scan_all_vertices(self) source code
 
run_basic_ai(self) source code
 
ai_loop(self) source code
 
select_target(self, unit) source code

Inherited from Player: add_building, add_troop, building_complete, cancel_cpu, check_loss, execute_build_building, execute_build_cpu, execute_build_troop, finish_research, on_destruction, perform_research, setup, setup_visibility, start_cpu, step, stop_cpu, switch_units_select_state, unit_attack, update_research_action_button, update_research_fac_menu, update_troop_action_button

Inherited from pyglet.event.EventDispatcher: dispatch_event, event, pop_handlers, push_handlers, remove_handler, remove_handlers, set_handler, set_handlers

Inherited from pyglet.event.EventDispatcher (private): _get_handlers, _raise_dispatch_exception

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from pyglet.event.EventDispatcher: register_event_type

Class Variables [hide private]

Inherited from pyglet.event.EventDispatcher (private): _event_stack

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ID, gameMap, cm, color, enemy)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)