Package cs171a2

Class GeneralPlayer<T>

java.lang.Object
cs171a2.GeneralPlayer<T>
Type Parameters:
T - the type of the value returned by the player's play method.
Direct Known Subclasses:
CardPlayer

public abstract class GeneralPlayer<T> extends Object
An abstract class representing a general player.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The name of the player.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new GeneralPlayer with a default name.
    Creates a new GeneralPlayer with the given name.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract T
    Makes a move or takes an action, depending on the implementation.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      public String name
      The name of the player.
  • Constructor Details

    • GeneralPlayer

      public GeneralPlayer()
      Creates a new GeneralPlayer with a default name.
    • GeneralPlayer

      public GeneralPlayer(String name)
      Creates a new GeneralPlayer with the given name.
      Parameters:
      name - the name of the player.
  • Method Details

    • play

      public abstract T play()
      Makes a move or takes an action, depending on the implementation.
      Returns:
      the result of the player's action or move.