Code Monkey home page Code Monkey logo

Comments (4)

saurabh1011 avatar saurabh1011 commented on June 3, 2024

APIS:

  1. String authenticate( String username, String password )
    method takes in a username and password and returns a String token to be used for other apis.
  2. Integer getScore( String token, String username )
    takes in the current token and username and returns the current score
    < score will be set only by server based on answer to question. so no setScore api for client ) >
  3. String getNextQuestion( String token, String username )
    Returns a json object that has details like questionID, link to image,list of options, hints invoked
  4. String getQuestionWithHintApplied( String token, String username, Integer questionID, Integer hintID )
    Returns a json question object with the appropriate hint applied
  5. boolean answerQuestion( String token, String username, Integer questionKey, Integer answerID )
    submits the answer to the question. Returns true or false depending on correct/incorrect answer.
    This does not return the score, an additional call will be made to get the score( proposing to keep these distinct , just seems cleaner but we can discuss ).

from ammasandra.

brijs avatar brijs commented on June 3, 2024

//
Firebase
Places [1000]
Paris
..
..

PUT /Game ==> Create a new game
// firebase: game123:[paris, nyc, ...]
=> return [game_id: 123]
***Think we should use POST here instead of PUT as that seems to be standard - but lets discuss this.**

get game details

GET /Game/:123/
=> static metadata
=> collection<Questions+Img+Options>
=> progress (current_score, current_question)

check answer

POST /Game/:123/questions/:56?
params: user_action: "ANSWER_QUESTION"
selection_option: "B"

return => updated Game_progress Game: [id:123, curr_q:8, curr_score_:120, pass/fail]

get hints: a) remove 2 incorrect b) show +1 pic c) TBD..

POST /Game/:123/questions/:56?
params: user_action: "REVEAL_HINT:SHOW_ANOTHER_PIC"

get user stats

GET /users/:id
-> profile / statistics..

from ammasandra.

saurabh1011 avatar saurabh1011 commented on June 3, 2024
  1. create game
    POST /game
    sample response: returns the gameid in json format:
    {
    "gameID": 51
    }
  2. get game details
    GET /game//
    sample response:
    {
    "nextQuestionId": 0,
    "questions": [
    {
    "imageLink": "http://cdn.history.com/sites/2/2013/12/new-york-city-H.jpeg",
    "options": [
    "mumbai",
    "paris",
    "new york city",
    "rome"
    ],
    "questionId": 0,
    "questionKey": 2
    },
    {
    "imageLink": "http://cache.graphicslib.viator.com/graphicslib/thumbs674x446/2050/SITours/eiffel-tower-paris-moulin-rouge-show-and-seine-river-cruise-in-paris-150305.jpg",
    "options": [
    "rome",
    "paris",
    " london",
    "new york city"
    ],
    "questionId": 1,
    "questionKey": 1
    }
    ],
    "score": 0,
    "userId": "sau"
    }
  3. check answer
    POST /Game//questions/?
    //server code currently does not take this user_action param ==> needs to be integrated.
    params: user_action: "ANSWER_QUESTION"
    sample json response:
    {
    "isAnswerCorrect": true,
    "score": 100
    }

other responses still need to be implemented ( hints and user details )

from ammasandra.

brijs avatar brijs commented on June 3, 2024

I merged your changes in server/app.py, and deleted your original py file.

from ammasandra.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.