Skip to content

mcdonnellb/Boggle-online

Repository files navigation

Terminal window

Boggle Online

Assignment Purpose

I chose to reimagine the 90's game 'Boggle' which was a physical game with an 8x8 grid, before the timer starts one user would shake the boggle board, remove the lid and start the timer. It would then be on the players to doucment as many words as possible using the letters on the board that are either in a row, or diagnally in a row.

The rules for playing the original Boggle are as follows:

  • Each word should be of at least three letters.
  • Words that have the exact spelling but different meanings will be counted only once.
  • You cannot repeat any words.
  • You can use both singular and plural forms of the same word.
  • The QU cube counts as two letters.

The user with the most words then wins.

I chose this game both to keep up with my theme of 90's nostalgia, but also because I felt this would be an approoprirate game for deployment within this command line environment.

Boggle online will be true to it's 90's self with the same simplistic rules, the biggest difference will be that the computer will be in lieu of a real opponent, using the google API to check validity of the words entered, and push to the high score sheet if user has attained a score higher than those already on the list.

The live version of my project is available at the below link:

https://boggle-online.herokuapp.com/

User Experience

Critical Objectives:

User Stories

User Goals

  • End user Goal
  • The application user wants to play a logic game based upon a classic board game
  • The application user wants to be challenged and entertained
  • The application user wants to know at all times what is happening, how to navigate, options etc
  • Site owner's goal:
  • The site owner goal is to provide a functioning, challenging game for a single user to play against the computer
  • The goal is to create an application as close to the original 90's Boggle game as is achievable within a command line application.
  • The goal is to create a workflow that is straightforward and thoughful
  • The goal is to create a program that end users will want to return to.

Overall requirements of Assessment:

Project Purpose:

In this project, Portfolio 3, the requirment was to build a command-line application that allows your users to manage a common dataset about a particular domain. As part of Project 3 - python Computer Program Development, the following items were required:

  • Implement a given algorithm as a computer program
  • Adapt and combine algorithms to solve a given problem
  • Adequately use standard programming constructs: repetition, selection, functions, composition, modules, aggregated data (arrays, lists, etc.)
  • Explain what a given program does
  • Identify and repair coding errors in a program
  • Use library software for building a graphical user interface, or command-line interface, or web application, or mathematical software
  • Implement a data model, application features and business logic to manage, query and manipulate data to meet given needs in a particular real-world domain.
  • Demonstrate and document the development process through a version control system such as GitHub
  • Deploy a command-line application

Game Workflow

  • The user is presented with a simple name input field
  • The user is then asked if they want Help H, New Game YES or Y, High Score H
  • If the user hits H the game instructions populate the screen, with the options for High Score and New Game remaining.
  • If the user hits N the New Game Screen Displays - user must input their username.
  • The board is presented to the screen with 8 x 8 grid containing letters
  • The user enters as many words as possible separated by a space in the input field
  • The user will be presented with the end game screen.
  • Return to main menu

Game Workflow

Game Workflow- Welcome Screen Game Workflow- High Score Screen Game Workflow- Help Screen Game Workflow- Game Started Game Workflow- Simple Validation

Design

I opted for bold ASCII art to try and enhance the appearance of my application. My initial iteration did not have this art and from feedback, users advised they would feel more inclined to return to the current application due to the osiitive emotional response they had when playing.

User Control

  • simplfied menu options to ensure user has ease of navigation through program

Confirmation

I added the following options to allow a user know that their data is good:

  • Print confirmation Messages following on from data input
  • I added a simple banner menu to reiterate the options to users and simplify UI / reduce risk of losing track of screen options

I added the following to let the user know they had entered bad data:

  • Print Message outlining what the issue is and what is expected
  • reprinting input to allow user to try again

Development and Implementation

Deployment Details

The project was deployed using the Code Institute terminal for Heroku. In order to deploy I completed the following:

  • I cloned the Python / project 3 repository and renamed / saved into my own GitHub repository.
  • I enabled Google Sheets API and Google Drive API
  • I created a service account and generated a creds.json file and added this to Gitpod
  • I added a line to gitignore so that the creds file would not be added to pushed with the commits for security reasons.
  • I created a new Heroku app with region set to Europe
  • I set the buildbacks from the settings tab to Python and NodeJS
  • I created a config var for creds so that Heroku can access google APIs.
  • I created a config var called PORT and set this value to 8000
  • I linked the Heroku app to my GITHUB repository
  • I clicked on the deploy option

Google API

I took inspiration from the Love Sandwiches project and decided to use a similar apporach to my computer Program, using Google Sheets to store data/ add data/ query data. The only use this has at present is storing high scores and printing these out. This will be further developed in future iterations.

Testing

I have manually tested my project by completing the folling steps:

  • Run the code through the PEP8 linter and confirmed all errors were cleared.
  • Tested mulitple inputs to ensure only valid data is accepted, and errors thrown in appropritate situations
  • Tested in both my local terminal and the Code Institute Heroku Terminal to ensure testing is thorough.

PEP8 validation

Error Log

The below are issues I encountered over the course of this Python computer program development:

  • Authentication issue with Google Sheets API- I had accidentally configured an API Key which was why I could not access my Google Sheets spreadsheet and kept getting the below error. As it transpired I also had a space in the file name which was not visible to the naked eye until you copy it and note the space, once the space was remove data was loaded without issue. gspread.exceptions.SpreadsheetNotFound
  • In order for input methods to work correctly in the deployed mock terminal,
    I added a new line character at the end of the text inside the input method.
    Without this extra line, the text for the import request will not show up in the terminal.
  • I got the initial gspread error when the code was deployed to Heroku which needed to be addressed with some additions to my requirements.txt file.
  • Timer was running independently so I needed to go back and check through my code, and I realised the function needed to be called after the characters were generated. I eneded up having to remove this functionality as it ran independtly and blocked the screen - so prevented user from entering in words.
  • Boggle Board Grid was either displaying 16 random characters in one line, or a grid of 4x4 with the top line containing random characters, and the lines below repeating the same characters.

Remaining Bugs

  • Timer was not working so was removed - please ignore any references
  • score check and dictionary check were not working so removed.

Quirks

  • One quite obvious quirk is my Boggle Board having square brackets and commas still intact. This was something I hoped to remove but I actually think the square brackets help give the board a grid- like appearance.

  • The timer is hidden as I was unable to prevent this from overwriting the user input text. It still runs in the background, you just can't see it or see how much time is left which is a shame.

  • The game functionality is not there at present - you can enter in any words you like and they will be accepted.

Future Development

  • I would definitley improve upon the game logic, only allowing a certain number of vowels, consonats and 1/2 Qu characters in the board generation.
  • The game logic would match the oringial game and only allow words that are connected in a row in the board.
  • I would also add logic for the computer to calculate the amount of English words found on the board and then run a comparison to what the end user found to calculate the score.

Validation Testing

Citations

First and foremost a huge thank you to Martina my mentor who has been extremely helpful in all of my assignemnets, but in particular with the Python assignment.

Kasia Bogucka, the course cohort leader who has been filling the cohort with confidence even on our bad days when we are struggling with our code, we end up leaaving our meeetings with a smile and a renewed positivity that we can achieve our goals.

The tutor support was something I have become more comfortbale using, and the team are really fantastic at their job. It is not a case of giving you the answer. By making you think ciritcally about the issue you are facing, you are steered back to core concepts that you covered over the course of the online content. Massive thank you to all at Code Institute for thier patience and can do attitude, inspiring us all to keep going.

TOC

Taken from my last assignment with hints taken from the below website:

Media

Flow chart created through Mural: https://app.mural.co/

Inspiritation

I relied heavily on the experience gained from the Love Sandwiches Project and used this as my basis for creating my application. I also sought inspiration from the battleships example given by Code Institute in terms of the logic used to create the application.

Websites:

Code Sources

Modules

I installed the following Modules for my project

  • GSPREAD -allow use of Google sheets api
  • Keyboard capture keyboard input
  • Random to allow ease of creating boogle board random characters
  • import re to alllow me to create a very basic regular expression / validation check
  • import sys - to allow sys exit option