Package behaviors

Class Guessing

java.lang.Object
behaviors.Guessing
All Implemented Interfaces:
lejos.robotics.subsumption.Behavior

public class Guessing extends Object implements lejos.robotics.subsumption.Behavior
Waits for the user to guess, when the guess switches to drawing and draws either hangman or (a) character(s) based on the guess.
Since:
2023
  • Constructor Summary

    Constructors
    Constructor
    Description
    Guessing constructor assigns surpressed to false.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Action method makes sure surpessed is false before starting and then sends a state packet to the server.
    void
    Uses surpress to exit the loop at times.
    boolean
    Takes control when the state is equal to the GUESSING state.

    Methods inherited from class java.lang.Object

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

    • Guessing

      public Guessing()
      Guessing constructor assigns surpressed to false.
  • Method Details

    • action

      public void action()
      Action method makes sure surpessed is false before starting and then sends a state packet to the server. Then it gets a packet from the server and gets the data, the data when type is guess will be the guess.
      Specified by:
      action in interface lejos.robotics.subsumption.Behavior
    • suppress

      public void suppress()
      Uses surpress to exit the loop at times.
      Specified by:
      suppress in interface lejos.robotics.subsumption.Behavior
    • takeControl

      public boolean takeControl()
      Takes control when the state is equal to the GUESSING state.
      Specified by:
      takeControl in interface lejos.robotics.subsumption.Behavior
      Returns:
      boolean