When a user opens the app, a session is created on the server, and they have 10 starting credits.
- When a user has less than 40 credits in the game session, their rolls are truly random.
- If a user has between 40 and 60 credits, then the server begins to slightly cheat: For each winning roll, before communicating back to client, the server does one 30% chance roll which decides if server will re-roll the that round. If that roll is true, then server re-rolls and communicates the new result back.
- If user has above 60 credits, the server acts the same, but in this case the chance of re-rolling the round increases to 60%. If that roll is true, then server re-rolls and communicates the new result back. There is a cash-out endpoint which moves credits from the game session to user's account and closes the session.
- A super simple, minimalistic table with 3 blocks in 1 row.
- A button next to the table that starts the game.
- The components for each sign is a starting letter (C for cherry, L for lemon, O for orange, W for watermelon).
- After submitting a roll-request to server, all blocks enter a spinning state.
- After receiving response from server, the first sign spins for 1 second more and then display the result, then display the second sign at 2 seconds, then the third sign at 3 seconds.
- If the user wins the round, their session credit is increased by the amount from the server response, else it is deducted by 1.
- There is a button on the screen that says "CASH OUT", but when the user hovers it, there is 50% chance that button moves in a random direction by 300px, and 40% chance that it becomes unclickable. If they succeed to hit it, credits from session are moved to their account.
Ruby 3.0.2
Ruby on Rails 6.1
ReactJS 17
TailwindCSS 2
git clone git@github.com:sharvy/casino-slot-machine-app-ruby-react-tailwind.git
cd casino-slot-machine-app-ruby-react-tailwind
yarn install
bundle
rails s
visit http://localhost:3000 on your web browser
RSpec tests:
rspec
Cypress tests:
# In one tab
CYPRESS=1 bin/rails server -p 5017
# In another tab
yarn cypress open --project ./spec