C# Class MBC.Controllers.RandomBot_old

Inheritance: MBC.Shared.Controller
Afficher le fichier Open project: aiclub/Mohawk_Battleship

Méthodes publiques

Méthode Description
MakeShot ( ) : Shot

This method is called when a shot is available to the controller. The Shot object is a reference to a copy held by the competition and is expected to be modified to the desired target. By default, the Shot receiver is the next controller in the turn.

MatchOver ( ) : void

This method is called when the match has completed. You can use this method in order to export debugging information or any reporting information that your bot has been tracking across all games here.

NewMatch ( ) : void

This method is called when a new match is starting. Note this is not what's called at the start of a round which is an individual game of battleship, a match consists of many rounds, by default 1,000. You can use this method to do some initialization routines for your bot that only need to happen at the start of a match.

NewRound ( ) : void

This method is called from the competition whenever this controller is being involved in a new match-up against a controller, or controllers. This can be treated similarly like a constructor for this controller for simplicity's sake.

OpponentDestroyed ( IDNumber destroyedID ) : void

This method is called when an opponent controller has had all their ships destroyed, and is no longer active in the game.

OpponentShot ( Shot shot ) : void

This method is called each time an opponent controller fires a shot. You can use this method to record the shots your opponent is making against your bot for your own analysis. This information is particularly useful for ship placement strategies.

PlaceShips ( ) : ShipList

This method is called when the controller is required to place ships. It is given a collection of Ship objects that can be accessed.

RoundLost ( ) : void

This method is called when the controller lost the round. You can use this method to output debugging information, or to store information about the game for future analysis.

RoundWon ( ) : void

This method is called when this controller won the round. You can use this method to output debugging information, or to store information about the game for future analysis.

ShotHit ( Shot shot, bool sunk ) : void

This method is called each time a shot made by your bot scores a hit against an enemy ship. This method is useful for updating your bots mapping information. NOTE: the sunk boolean will only let your bot know that a ship has been sunk, it does not indicate which ship has been sunk.

ShotMiss ( Shot shot ) : void

This method is called each time a shot made by your bot misses. This information is useful for updating your bots mapping information.

Private Methods

Méthode Description
NextRandomShot ( ) : Shot

This method gets a random Shot that remains in the shotQueue.

RandomCoordinates ( ) : Coordinates

This method generates a random set of coordinates within the match field boundaries.

RandomShipOrientation ( ) : ShipOrientation

This method randomly returns one of two ShipOrientation enums.

SetShots ( ) : void

This method will create a new ShotList in the shotQueue field of this controller. It will fill this ShotList with shots that this controller has available.

Method Details

MakeShot() public méthode

This method is called when a shot is available to the controller. The Shot object is a reference to a copy held by the competition and is expected to be modified to the desired target. By default, the Shot receiver is the next controller in the turn.
public MakeShot ( ) : Shot
Résultat Shot

MatchOver() public méthode

This method is called when the match has completed. You can use this method in order to export debugging information or any reporting information that your bot has been tracking across all games here.
public MatchOver ( ) : void
Résultat void

NewMatch() public méthode

This method is called when a new match is starting. Note this is not what's called at the start of a round which is an individual game of battleship, a match consists of many rounds, by default 1,000. You can use this method to do some initialization routines for your bot that only need to happen at the start of a match.
public NewMatch ( ) : void
Résultat void

NewRound() public méthode

This method is called from the competition whenever this controller is being involved in a new match-up against a controller, or controllers. This can be treated similarly like a constructor for this controller for simplicity's sake.
public NewRound ( ) : void
Résultat void

OpponentDestroyed() public méthode

This method is called when an opponent controller has had all their ships destroyed, and is no longer active in the game.
public OpponentDestroyed ( IDNumber destroyedID ) : void
destroyedID MBC.Shared.IDNumber
Résultat void

OpponentShot() public méthode

This method is called each time an opponent controller fires a shot. You can use this method to record the shots your opponent is making against your bot for your own analysis. This information is particularly useful for ship placement strategies.
public OpponentShot ( Shot shot ) : void
shot Shot
Résultat void

PlaceShips() public méthode

This method is called when the controller is required to place ships. It is given a collection of Ship objects that can be accessed.
public PlaceShips ( ) : ShipList
Résultat ShipList

RoundLost() public méthode

This method is called when the controller lost the round. You can use this method to output debugging information, or to store information about the game for future analysis.
public RoundLost ( ) : void
Résultat void

RoundWon() public méthode

This method is called when this controller won the round. You can use this method to output debugging information, or to store information about the game for future analysis.
public RoundWon ( ) : void
Résultat void

ShotHit() public méthode

This method is called each time a shot made by your bot scores a hit against an enemy ship. This method is useful for updating your bots mapping information. NOTE: the sunk boolean will only let your bot know that a ship has been sunk, it does not indicate which ship has been sunk.
public ShotHit ( Shot shot, bool sunk ) : void
shot Shot The coordinates of the shot that hit
sunk bool Returns true if the shot caused an enemy ship to sink
Résultat void

ShotMiss() public méthode

This method is called each time a shot made by your bot misses. This information is useful for updating your bots mapping information.
public ShotMiss ( Shot shot ) : void
shot Shot The coordinates of the shot that missed.
Résultat void