C# Class EricVoglBattleship.AdaptiveBattleshipOffense

Battleship offense that attempts to shoot at the most probable location on the board, given possible ship positions and previous placement history
Inheritance: IBattleshipOffense
ファイルを表示 Open project: solium/hacklympics Class Usage Examples

Public Methods

Method Description
Cleanup ( GameEndState state ) : void

Cleans up an offense

DumpProbabilities ( ) : void

Display probabilities (DEBUG)

Fire ( ) : Position

Fires at a position

Hit ( ) : void

Register last fire as a hit

Initialize ( BattleshipPlayer player ) : void

Initializes a battleship offense

Miss ( ) : void

Register last fire as a miss

RegisterEnemyPositions ( List ships ) : void

Enemy positions sent to us after game ends

Sink ( string s ) : void

Notify that a ship has sunk

Private Methods

Method Description
AdjacentPositions ( Position p ) : IEnumerable

Returns all positions adjacent to a position

AdjustNotAdjacentScore ( Position pos ) : void

Adjust scores in the not-adjacent matrix

AdjustScore ( Position pos ) : void

Adjust scores based on the last shot

CheckAdjacent ( int row, int col, List candidates, double &maxValue ) : void

Checks adjacent squares for candidates

DestroyShot ( ) : List

Find next best shots in destroy mode

DetermineRemainingPositions ( ) : void

Adjust the total remaining positions

HistoricalHitProbability ( int row, int col ) : double

Determines the historical hit probability

NeighborScore ( Position pos, bool normalize ) : double

Determines the Neighbor score at a given position

Score ( int row, int col, bool includeNeighbor ) : double

Determines total probability at position p

SearchShot ( bool even ) : List

Choose the next best shot in Search mode

Sink ( Ship ship ) : void

Adjust position possibilies based on the fact that a ship was sunk

Method Details

Cleanup() public method

Cleans up an offense
public Cleanup ( GameEndState state ) : void
state GameEndState
return void

DumpProbabilities() public method

Display probabilities (DEBUG)
public DumpProbabilities ( ) : void
return void

Fire() public method

Fires at a position
public Fire ( ) : Position
return Position

Hit() public method

Register last fire as a hit
public Hit ( ) : void
return void

Initialize() public method

Initializes a battleship offense
public Initialize ( BattleshipPlayer player ) : void
player BattleshipUtility.BattleshipPlayer owning player
return void

Miss() public method

Register last fire as a miss
public Miss ( ) : void
return void

RegisterEnemyPositions() public method

Enemy positions sent to us after game ends
public RegisterEnemyPositions ( List ships ) : void
ships List
return void

Sink() public method

Notify that a ship has sunk
public Sink ( string s ) : void
s string Code representing the ship
return void