The Data Structures Game is a competitive online game. The goal of this game is to help reinforce data structures concepts to students. Players will be able to take turns and test their data structures prowess as they try to free the golden node. Correctly maneuvering your way through the AVL tree will reward you with points. Test yourself against your friends, both in the lobby and on the leaderboards!
๐ฎ Play Now โ ๐พ API โ โน๏ธ Wiki
- Install Anaconda
- Create a minimal-empty Python environment:
conda create --name dsg python=3.8.5
source activate dsg
(orconda activate dsg
). Note thatdsg
is just a name. You may choose differently. The rest of the documentation assumes you named the environmentdsg
.
- Install NodeJS for React (make sure you are in
dsg
):
conda install nodejs
- Add the local environment variables to your path. The environment variables include the secret keys needed to run the software. Contact the development team
- Mac
nano ~/.bash_profile
and add the variables at the bottom. Close, and save.source ~/.bash_profile
to use the changed bash profile.source activate dsg
to change it back to the virtual environment (orconda activate dsg
).env
to check the variables. It should print them on the console.
- Windows
- Clone the repository:
git clone https://github.com/MaksimEkin/data-structures-game.git
- Install the libraries needed by the project using the
requirements.txt
located at the root directory of the project file you cloned (make sure you are ondsg
):
pip install -r requirements.txt
- Install the NodeJS libraries used by React:
npm install
- Front-end makes API requests to Heroku. When the project is run locally, this results in cross origin calls from localhost to Heroku domain. Cross-origins calls are blocked due to a header that is in place to protect against XSS attacks. To run the code locally, you will need to change the API call url.
- Open src/Components/GameBoard.js to edit/
- Change
const url = remote;
withconst url = local;
. Code.
- Build the front-end:
npm run build
- Run from the root directory of the project:
python manage.py runserver
and visithttp://127.0.0.1:8000
- If you recieve security warnings resulting from Mimetype or cross-origin, run with below instead:
python manage.py runserver --insecure
and visithttp://127.0.0.1:8000
-
Game Board API
- Located at game_board/api/tests_api.py
- Run from the root directory of the project with
python manage.py test game_board.api.tests_api
-
Profile Page API
- Located at profile_page/api/tests_api.py
- Run from the root directory of the project with
python manage.py test profile_page.api.tests_api
-
Homepage
- Located at home_page/api/tests_api.py
- Run from the root directory of the project with
python manage.py test home_page.api.tests_api
-
Game Board Database
- Located at game_board/database/test_db.py
- Run from the root directory of the project with
python manage.py test game_board.database.test_db
-
User Profile Database
- Located at profile_page/database/test_db.py
- Run from the root directory of the project with
python manage.py test profile_page.database.test_db
-
Home Page Database
- Located at home_page/database/test_db.py
- Run from the root directory of the project with
python manage.py test home_page.database.test_db
-
AVL Data Structure
- Located at game_board/avl/test_avl.py
- Run from the root directory of the project with
python manage.py test game_board.avl.test_avl
-
Front-End Cypress Testing
- Located at cypress/integration
- Run using Cypress, which can be started with
npx cypress open
- Once Cypress is running, select any tests that the Cypress-generated GUI displays to run them
-
Front-end Text Diplay Tests:
- Note: Developed to be run on Safari. In Safari under the Develop menu Allow Remote Automation. Then change the remote url variable to local in GameBoard.js. Build the project with
npm run build
, and run Djangopython manage.py runserver
. Tests can be run fromsrc/Tests
. - Test 1:
python -m unittest test_player_display_text.py
- Test 2:
python -m unittest test_node_text.py
- Note: Developed to be run on Safari. In Safari under the Develop menu Allow Remote Automation. Then change the remote url variable to local in GameBoard.js. Build the project with