Abstract base class for computer players.
Namespace:
SoftwareArchitects.BattleshipsAssembly: SoftwareArchitects.Battleships (in SoftwareArchitects.Battleships.dll)
Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# |
|---|
public abstract class Player : MarshalByRefObject |
| Visual Basic (Declaration) |
|---|
Public MustInherit Class Player _ Inherits MarshalByRefObject |
| Visual C++ |
|---|
public ref class Player abstract : public MarshalByRefObject |
Remarks
Because of security reasons computer player classes may only use classes from the assemblies mscorlib.dll, System.dll and System.Core.dll (.NET 3.5).
Examples
The following example shows how to use the class Player by implementing a very simple computer player.
CopyC#
using SoftwareArchitects.Battleships; namespace Battleships { [Player(Name = "Demo Player")] public class DemoPlayer : Player { private int x; private int y; public DemoPlayer() { } public override void Move(PlayingField playingField) { playingField.Fire(x, y); if (x + 1 >= playingField.Size) { x = 0; y++; } else { x++; } } } }