Package edu.wisc.game.rest

## Class GameService2

- java.lang.Object
- - edu.wisc.game.rest.GameService2

- Direct Known Subclasses:
    `CheckPlanService`, `GameService2Html`

      @Path("/GameService2")
      public class GameService2
      extends Object

  The "Second Batch" of API calls, primarily for use with players constrained by an experiment plan, and playing a sequence of games as outlined in the trial list to which the player is assigned. This API is set up in accordance with Kevin Mui's request, 2020-08-17.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GameService2()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ActivateBonusWrapper` | `activateBonus​(String playerId)` |
    `ColorMap` | `colorMap()` | Returns a hash map that maps each color name (in upper case) to a vector of 3 integers, representing RGB values.
    `PlayerResponse` | `debug​(String playerId, String exp)` |
    `Episode.Display` | `display​(String episodeId)` |
    `String` | `getVersion()` | Reports the current version of the server
    `GiveUpWrapper` | `giveUp​(String playerId, int seriesNo)` |
    `FileWriteReport` | `guess​(String episodeId, String text, int confidence)` | Records a player's guess about the rules.
    `ListShapesWrapper` | `listShapes()` | Lists the names of all shapes.
    `NewEpisodeWrapper2` | `mostRecentEpisode​(String playerId)` |
    `Episode.Display` | `move​(String episodeId, int x, int y, int cnt)` |
    `Episode.Display` | `move​(String episodeId, int x, int y, int bx, int by, int cnt)` |
    `NewEpisodeWrapper2` | `newEpisode​(String playerId, boolean activateBonus, boolean giveUp)` |
    `PlayerResponse` | `player​(String playerId, String exp)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GameService2

          public GameService2()

  - ### Method Detail

    - #### player

          @POST
          @Path("/player")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public PlayerResponse player​(@FormParam("playerId")
                                       String playerId,
                                       @DefaultValue("null") @FormParam("exp")
                                       String exp)

    - #### mostRecentEpisode

          @POST
          @Path("/mostRecentEpisode")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public NewEpisodeWrapper2 mostRecentEpisode​(@FormParam("playerId")
                                                      String playerId)

    - #### newEpisode

          @POST
          @Path("/newEpisode")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public NewEpisodeWrapper2 newEpisode​(@FormParam("playerId")
                                               String playerId,
                                               @DefaultValue("false") @FormParam("activateBonus")
                                               boolean activateBonus,
                                               @DefaultValue("false") @FormParam("giveUp")
                                               boolean giveUp)

    - #### display

          @GET
          @Path("/display")
          @Produces("application/json")
          public Episode.Display display​(@QueryParam("episode")
                                         String episodeId)

    - #### move

          @POST
          @Path("/move")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public Episode.Display move​(@FormParam("episode")
                                      String episodeId,
                                      @FormParam("x")
                                      int x,
                                      @FormParam("y")
                                      int y,
                                      @FormParam("bx")
                                      int bx,
                                      @FormParam("by")
                                      int by,
                                      @FormParam("cnt")
                                      int cnt)

    - #### move

          @POST
          @Path("/pick")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public Episode.Display move​(@FormParam("episode")
                                      String episodeId,
                                      @FormParam("x")
                                      int x,
                                      @FormParam("y")
                                      int y,
                                      @FormParam("cnt")
                                      int cnt)

    - #### activateBonus

          @POST
          @Path("/activateBonus")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public ActivateBonusWrapper activateBonus​(@FormParam("playerId")
                                                    String playerId)

    - #### giveUp

          @POST
          @Path("/giveUp")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public GiveUpWrapper giveUp​(@FormParam("playerId")
                                      String playerId,
                                      @FormParam("seriesNo")
                                      int seriesNo)

    - #### debug

          @GET
          @Path("/debug")
          @Produces("application/json")
          public PlayerResponse debug​(@QueryParam("playerId")
                                      String playerId,
                                      @DefaultValue("null") @QueryParam("exp")
                                      String exp)

    - #### guess

          @POST
          @Path("/guess")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("application/json")
          public FileWriteReport guess​(@FormParam("episode")
                                       String episodeId,
                                       @FormParam("data")
                                       String text,
                                       @DefaultValue("-1") @FormParam("confidence")
                                       int confidence)

      Records a player's guess about the rules. This is typically used at the end of an episode.

    - #### colorMap

          @GET
          @Path("/colorMap")
          @Produces("application/json")
          public ColorMap colorMap()

      Returns a hash map that maps each color name (in upper case) to a vector of 3 integers, representing RGB values. The data come from the file in game-data/colors. Note that calling this method causes the system to re-read the file; so the client may want to cache the data.

    - #### listShapes

          @GET
          @Path("/listShapes")
          @Produces("application/json")
          public ListShapesWrapper listShapes()

      Lists the names of all shapes. This can be used e.g. in a board editor.

    - #### getVersion

          @GET
          @Path("/getVersion")
          @Produces("application/json")
          public String getVersion()

      Reports the current version of the server