{"id":28974813,"url":"https://github.com/plcoster/fcc_rel_db_project5","last_synced_at":"2025-06-24T12:07:06.260Z","repository":{"id":299016125,"uuid":"545746487","full_name":"PLCoster/fcc_rel_db_project5","owner":"PLCoster","description":"FreeCodeCamp Relational Database Project 5: Number Guessing Game","archived":false,"fork":false,"pushed_at":"2022-10-04T23:00:39.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T06:32:58.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PLCoster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-04T22:58:54.000Z","updated_at":"2022-10-04T23:00:43.000Z","dependencies_parsed_at":"2025-06-14T06:33:03.918Z","dependency_job_id":"997596aa-e2ae-4cdb-adb7-872e8f0e2ab8","html_url":"https://github.com/PLCoster/fcc_rel_db_project5","commit_stats":null,"previous_names":["plcoster/fcc_rel_db_project5"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PLCoster/fcc_rel_db_project5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_rel_db_project5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_rel_db_project5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_rel_db_project5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_rel_db_project5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PLCoster","download_url":"https://codeload.github.com/PLCoster/fcc_rel_db_project5/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_rel_db_project5/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261669002,"owners_count":23192362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-24T12:07:05.208Z","updated_at":"2025-06-24T12:07:06.219Z","avatar_url":"https://github.com/PLCoster.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Free Code Camp: Relational Database Project 5\n\n## Number Guessing Game\n\nThe aim of this project was to create a Bash script that utilises a PostgreSQL database to create a simple number guessing game with player statistic tracking.\n\n### Project Requirements:\n\n- **User Story #1:** Create a `number_guessing_game` folder in the `project` folder for your program\n\n- **User Story #2:** Create `number_guess.sh` in your `number_guessing_game` folder and give it executable permissions\n\n- **User Story #3:** Your script should have a shebang at the top of the file that uses `#!/bin/bash`\n\n- **User Story #4:** Turn the `number_guessing_game` folder into a git repository\n\n- **User Story #5:** Your git repository should have at least five commits\n\n- **User Story #6:** Your script should randomly generate a number that users have to guess\n\n- **User Story #7:** When you run your script, you should prompt the user for a username with `Enter your username:`, and take a username as input. Your database should allow usernames of at least 22 characters\n\n- **User Story #8:** If that username has been used before, it should print `Welcome back, \u003cusername\u003e! You have played \u003cgames_played\u003e games, and your best game took \u003cbest_game\u003e guesses.`, with `\u003cusername\u003e` being a users name from the database, `\u003cgames_played\u003e` being the total number of games that user has played, and `\u003cbest_game\u003e` being the fewest number of guesses it took that user to win the game\n\n- **User Story #9:** If the username has not been used before, you should print `Welcome, \u003cusername\u003e! It looks like this is your first time here.`\n\n- **User Story #10:** The next line printed should be `Guess the secret number between 1 and 1000:` and input from the user should be read\n\n- **User Story #11:** Until they guess the secret number, it should print `It's lower than that, guess again:` if the previous input was higher than the secret number, and `It's higher than that, guess again:` if the previous input was lower than the secret number. Asking for input each time until they input the secret number.\n\n- **User Story #12:** If anything other than an integer is input as a guess, it should print `That is not an integer, guess again:`\n\n- **User Story #13:** When the secret number is guessed, your script should print `You guessed it in \u003cnumber_of_guesses\u003e tries. The secret number was \u003csecret_number\u003e. Nice job!`\n\n- **User Story #14:** The message for the first commit should be `Initial commit`\n\n- **User Story #15:** The rest of the commit messages should start with `fix:`, `feat:`, `refactor:`, `chore:`, or `test:`\n\n- **User Story #16:** You should finish your project while on the `main` branch, your working tree should be clean, and you should not have any uncommitted changes\n\n### Project Writeup:\n\nThe fifth Free Code Camp: Relational Database project is an interactive Number Guessing Game, where users try to guess a randomly generated number. On a missed guess, they are given a hint as to whether the target number is larger or smaller than their guess.\n\nUsers supply a unique username to the script, allowing their number of games played and best game (fewest required guesses) to be tracked using a PostgreSQL database.\n\n### Usage\n\nThe database can be interacted with using `psql` in linux. First start up a PostgreSQL server using:\n\n`$ sudo service postgresql start`\n\nThe number_guess database should then be loaded from the `number_guess.sql` file using:\n\n`$ psql --dbname=postgres \u003c number_guess.sql`\n\nOptionally the database can be interacted with directly using:\n\n`$ psql --dbname=postgres`\n\nOnce loaded, the bash script can be run for the number guessing game. (Note that you will have to change the `--username=freecodecamp` option on line 12 of the script to your linux username or remove this entirely):\n\n`$ ./number_guess.sh`\n\nSave a dump of the live database using:\n\n`$ pg_dump -cC --inserts number_guess \u003e number_guess.sql`\n\nInstructions for building the project can be found at https://www.freecodecamp.org/learn/relational-database/build-a-number-guessing-game-project/build-a-number-guessing-game\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_rel_db_project5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplcoster%2Ffcc_rel_db_project5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_rel_db_project5/lists"}