Class RevealFreshCardCommand

java.lang.Object
ca.uqam.info.controller.RevealFreshCardCommand
All Implemented Interfaces:
ca.uqam.info.mgl7010.max.skyjo.controller.Command

public class RevealFreshCardCommand extends Object implements ca.uqam.info.mgl7010.max.skyjo.controller.Command
Command implementation for drawing a fresh card from the deck in Skyjo game. This command represents the player's decision to take the top card from the deck and place it in their personal buffer for potential use during their turn. After executing this command, the player can choose to either keep the drawn card (by replacing one of their own cards) or reject it (using RejectCardCommand). This command makes the RejectCardCommand available in the follow-up options.
Version:
2.1
Author:
Mohamed Latif Diallo, Hamza Afif, Ussel Sabbat
  • Constructor Summary

    Constructors
    Constructor
    Description
    RevealFreshCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model)
    Constructs a new RevealFreshCardCommand with the specified game model.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Executes the reveal fresh card command by: 1.
    ca.uqam.info.mgl7010.max.skyjo.controller.Command[]
    After execution of a command calling this method creates a list of legal follow-up commands.
    boolean
    Indicates whether this command supports undo operations.
    Returns the name of the command
    void
    Undo operation for this command.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RevealFreshCardCommand

      public RevealFreshCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model)
      Constructs a new RevealFreshCardCommand with the specified game model.
      Parameters:
      model - the Skyjo game model instance, must not be null
  • Method Details

    • execute

      public void execute()
      Executes the reveal fresh card command by: 1. Drawing the top card from the deck (removing it from the deck) 2. Placing the drawn card in the player's buffer for decision-making The card is now available in the buffer and the player must decide whether to keep it (by replacing one of their cards) or reject it (sending it to discard). This action does not end the player's turn - they must make a subsequent decision.
      Specified by:
      execute in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
    • undo

      public void undo()
      Undo operation for this command. Not implemented for TP2 requirements. This method is part of the Command interface but remains unused in this version.
      Specified by:
      undo in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
    • isUndoable

      public boolean isUndoable()
      Indicates whether this command supports undo operations.
      Specified by:
      isUndoable in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
      Returns:
      false as undo functionality is not implemented for TP2
    • getFollowUpCommands

      public ca.uqam.info.mgl7010.max.skyjo.controller.Command[] getFollowUpCommands()
      After execution of a command calling this method creates a list of legal follow-up commands. Can only be empty at game end. Returns: legal followup commands.
      Specified by:
      getFollowUpCommands in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
    • toString

      public String toString()
      Returns the name of the command
      Overrides:
      toString in class Object
      Returns:
      a string representing the name of the class