NOTE: The treasure coordinates that appear on the log have been removed and have only been placed there to test the UI.
- Active Record Encryption
Implemented Active Record
encrypts
Encrypted values everywhere show up on server logs as
[FILTERED]
. If this was not the case, an attacker could parse an append-only log and cheat.
Also, the use of
Dotenv
allows for an.env
file to provideENV
variables in theTreasureHunt::Application
file. These environment variables are initialized the encrypted keys are used by ActiveRecord to safely persist values in a data store/database.
- Class Encapsulation
In addition to the tools that ActiveRecord provides with Model encapsulation, the
Move
class sets a distinction betweenpublic
api methods and those that are only accessible to the class. This ensures that the state of theMove
andGame
classes are tightly controlled by the instantiated objects.
- Devise for Authentication
Devise is a Ruby gem that provides reasonable and safe authentication machinery.
The game board consists of a multi-dimensional Ruby array where a randomly generated treasure plot is set on. Once set, this plot location is encrypted and the player takes guesses for North(- negative)/South(+ positive), East(- negative)/West(+ positive) move pairs. Each unit represents 100 meters. Given more time, I would improve this interface but for a first pass, the primitive controls serve their purpose to play the game.