Class GameService2

  • Direct Known Subclasses:
    AutomaticRuleGeneratorService, 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 Detail

      • GameService2

        public GameService2()
    • Method Detail

      • registerUser

        @POST
        @Path("/registerUser")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("application/json")
        public UserResponse registerUser​(@DefaultValue("null") @FormParam("email")
                                         String email,
                                         @DefaultValue("null") @FormParam("nickname")
                                         String nickname,
                                         @DefaultValue("false") @FormParam("anon")
                                         boolean anon)
      • player

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

        @POST
        @Path("/mostRecentEpisode")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("application/json")
        public NewEpisodeWrapper2 mostRecentEpisode​(@FormParam("playerId")
                                                    String playerId)
        Changed to existing=false on 2022-11-04, due to an error reported by Paul.
      • 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 EpisodeInfo.ExtendedDisplay display​(@DefaultValue("null") @QueryParam("playerId")
                                                   String playerId,
                                                   @QueryParam("episode")
                                                   String episodeId)
      • move

        @POST
        @Path("/move")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("application/json")
        public EpisodeInfo.ExtendedDisplay move​(@DefaultValue("null") @FormParam("playerId")
                                                String playerId,
                                                @FormParam("episode")
                                                String episodeId,
                                                @DefaultValue("-1") @FormParam("x")
                                                int x,
                                                @DefaultValue("-1") @FormParam("y")
                                                int y,
                                                @DefaultValue("-1") @FormParam("bx")
                                                int bx,
                                                @DefaultValue("-1") @FormParam("by")
                                                int by,
                                                @DefaultValue("-1") @FormParam("id")
                                                int pieceId,
                                                @DefaultValue("-1") @FormParam("bid")
                                                int bucketId,
                                                @FormParam("cnt")
                                                int cnt)
      • move

        @POST
        @Path("/pick")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("application/json")
        public EpisodeInfo.ExtendedDisplay move​(@DefaultValue("null") @FormParam("playerId")
                                                String playerId,
                                                @FormParam("episode")
                                                String episodeId,
                                                @DefaultValue("-1") @FormParam("x")
                                                int x,
                                                @DefaultValue("-1") @FormParam("y")
                                                int y,
                                                @DefaultValue("-1") @FormParam("id")
                                                int pieceId,
                                                @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)
      • guess

        @POST
        @Path("/guess")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("application/json")
        public FileWriteReport guess​(@DefaultValue("null") @FormParam("playerId")
                                     String playerId,
                                     @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
      • abandon

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