Giter Site home page Giter Site logo

trust-game's Introduction

Trust Game Demo

This is a webapp that runs a mock interactive Trust Game between 2 people. It's built using:

  • SvelteJS as an intuitive javascript framework for layout and logic
  • TailwindCSS for styling
  • Firebase for server-less data storage (and real-time updates)
  • Netlify for automatic deploying and hosting from github

Trial Phase schematic

  1. Investor receives endowment and makes decision; Trustee sees endowment make prediction rating.
  2. Investor makes 1st order expectation rating; Trustee make prediction rating and 2nd order expectation rating
  3. Trustee makes decision
  4. Both see trial outcome
  5. Both rate how guilty they feel given partner's expectation as well as give counterfactual guilt rating
  6. Fixation

One time CORS configuration

In order to actually make any stored/static files (i.e. mp3s, videos, etc) accessible by the app you must set the CORS access policy on google cloud:

  1. Download gsutil
  2. Unzip it, cd into the unzipped folder, and run: install.sh
  3. Then run gcloud init and login with the same google account you used to create your firebase project
  4. Create a file called cors.json that contains the following:
  [
    {
      "origin": ["*"],
      "method": ["GET"],
      "maxAgeSeconds": 3600
    }
  ]
  1. Find your google storage URL which should be something like gs://yourproject.appspot.com
  2. Run gsutil cors set cors.json yourURL

trust-game's People

Contributors

wasita avatar ejolly avatar

Stargazers

Zhaoning Li avatar

Watchers

Luke Chang avatar  avatar Andy Chen avatar  avatar  avatar

trust-game's Issues

Feedback on UI

Just a few quick comments based on demo with @YounZGrace.

  • A lot of numbers to keep track of. UI seems a bit cluttered. I get that the idea is to minimize math in the head, but I'm having a hard time knowing where to focus. I think it would be more intuitive to have a box with bigger numbers in the center that corresponds to the slider value, instead of computing amount to me and amount to partner on each anchor. Not intuitive.
  • Name seems like it might be hardcoded right now and not using the name submitted by the user.
  • For Trustee - It is important to see what the investment is from Player 1. On Second order belief screen, it's not obvious what the investment was. Something like "Grace invested $2.50 out of $5.00", which becomes $10.
  • Multiplier should be 4 by default unless we are doing hidden multiplier version.
  • It's hard to keep track of total amount of money for player 1 from player 2's perspective.
  • Summary screen is hard to follow. Here is what I recommend. Focus on Player 1's investment, "Grace invested $2.50 out of $5.00", which becomes $10." "You returned $5.00". Grace gets $7.50 and you get $5.00". Remove all of the ratings here. Then you can hand down Grace's expectation on the next screen. "Grace expected you to return $5.00". On this screen you will want to make your guilt ratings.
  • Remove anger, partner's guilt, closeness, satisfaction for now to simplify to the essence.
  • Let's add a counterfactual guilt rating. How this works is you show a summary of the trial and then ask "How much guilt would you feel if you returned $XX amount of Money?" XX will be a number that is lower than the amount actually returned.
  • In the actual experiments, we never ask guilt in between trials so as to not bias the participants to focus on guilt (or any emotion).
  • #8

function for generating trials & binding to reset group button

currently, we're hard-coding trials into the firestore database, but ideally in the future should have a function in utils that generates a trial sequence (list of possible endowments). this function should also be called when a user presses the 'reset group' button

separate text out into separate lang json file

fully separate out written text (e.g. instructions, trial information, and questions) from code. have a function in utils load the json file in, load into wherever that specific text is needed using template literals

Link to a demo?

@wasita: any chance we could include a link to a working demo? We don't necessarily need to save data, but it would be nice to have people match so they can see how it works.

fix: NaN bug

discovered 1/29/23

maybe comes from situations where someone gives an amount between 0 and 1 and it then gets rendered incorrectly as a nan? will investigate

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.