Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • namy2/se3xa3
  • bokhari/se3xa3
  • kanwalg/se3xa3
  • sunx20/se3xa3
  • hameea1/se3xa3
  • aij/se3xa3
  • hanzy3/se3xa3
  • linl20/se3xa3
  • zhous20/se3xa3
9 results
Show changes
Showing
with 1789 additions and 8 deletions
\documentclass[12pt, titlepage]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{xcolor}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue
}
\usepackage[round]{natbib}
\title{SE 3XA3: Software Requirements Specification\\\textcolor{red}{Snake 2.o}}
\author{Team 30, VUA
\\ Andy Hameed | hameea1
\\ Usman Irfan | irfanm7
\\ Vaibhav Chadah | chadhav
}
\date{\today}
\begin{document}
\maketitle
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\begin{table}[bp]
\caption{\bf Revision History}
\begin{tabularx}{\textwidth}{p{3cm}p{2cm}X}
\toprule {\bf Date} & {\bf Version} & {\bf Notes}\\
\midrule
Oct 5, 2018 & 1.0 & Andy worked on Project Drivers and Project Issues. Usman worked on Functional requirements. Vaibhav worked on Non-Functional Requirements\\
\textcolor{red}{Dec 2, 2018} & 1.1 & Vaibhav is performing revision 1 in order to improve the quality of the document\\
\textcolor{blue}{Dec 2, 2018} & 1.1 & Andy edited the formatting issues stated in feedback for Revision 1\\
\textcolor{red}{Dec 2, 2018} & 1.1 & Usman is performing revision 1 in order to improve the quality of the document\\
\bottomrule
\end{tabularx}
\end{table}
\newpage
\pagenumbering{arabic}
This document describes the requirements for Snake 2.o The template for the Software
Requirements Specification (SRS) is a subset of the Volere
template~\citep{RobertsonAndRobertson2012}. If you make further modifications
to the template, you should explicity state what modifications were made.
\section{Project Drivers}
\subsection{The Purpose of the Project}
Almost everyone nowadays relies on a computer as a multipurpose tool for research, video streaming, gaming and many other tasks. With the emergence of fast computing, gaming has become a popular pastime activity and a source of entertainment for many. However, not everyone has a device powerful enough to support extensive game applications. A simple, memory-effecient application of the Snake game allows it to be accessible for gamers without the need for extensive hardware or a high-performance computer. Our team, VUA30, will be creating a desktop application for the well-known “Snake” game with new enhancements and features. This competitive and addictive game can allow the user to play at their own pace and challenge their own high score.
Buying a computing device with high storage and faster performance can be out of budget. Complicated software covers up all the storage and the user is bound to use these applications as opposed to downloading other software. The importance of the redevelopment of “The Snake” is to save computing device’s personal storage and allow the user to play a game 24/7 with strong performance, even offline. Creating a desktop version of the snake game can fit into the category of downloadable calssical games such as the solitaire suite. The recreation of this game will allow the user to enjoy the classical game anytime and anywhere as long as they have installed the application. Improving aspects such as graphics and custom speed will also make the game more interesting. We would like to add more features to the game to make it more customizable and help people enjoy the classical game in an exciting and new way.
\subsection{The Stakeholders}
Stakeholders involved will be contained within the gaming community, more specifically the desktop gaming community and casual PC owners who are
looking for a fun reliever for boredom or quick game to play.This also includes members invested in the project which are mentioned in the subsesctions below.
\subsubsection{The Client}
Since this game is a separate entity, the clients are the designers in this project team. In further developments and upon increase in game popularity, the clients
could be a desktop gaming distribution service such as steam, google play or apple store. Otherwise, the main client would be Dr. Bokhari who has assigned the project.
\subsubsection{The Customers}
The main users or customers are desktop gamers, older generation of game enthusiasts, youth and teens. However, the client can be anyone with a PC and an interest in classical gaming or a sudden craving for playing the classical Snake game. Often times, these games are a quick fix to boredom for those who are casually browing their PC's, so the game will be designed to provide enough stimulus and excitmement for regular computer users, similar to the solitaire suite.
\subsubsection{Other Stakeholders}
Aside from the clients and customers, other stakeholder include 3rd party Desktop game distribution stores and open source project banks which may make use of this project for development purposes:
\begin{itemize}
\item 3rd party desktop game distribution stores.
\item Game Testers.
\item Technology Experts [Part of Project Team].
\item Usability experts.
\item Dr. Bokhari.
\item Project Development Experts: This can include teaching assistants, the professor, experienced peers and so on.
\end{itemize}
\subsection{Mandated Constraints}
Some constraints that apply to the project include the following:
\begin{itemize}
\item No project budget provided; Project cannot use costly API memberships or resources.
\item Application should take less than 400MB of storage space to meet requirements.
\item The project must be completed within a 4-month period.
\item Limited resources in terms of domain experts, specifically in graphic design.
\item Application will be developed for one OS due to time constraint.
\item open source project must be translated to Python due to development language and scope.
\end{itemize}
\subsection{Naming Conventions and Terminology}
The naming conventions listed below will be used to clearly define words and termiology that will come up in the project development process. Below is a list
of naming conventions, terms, and special vocabularly and their meaning. Since the desktop application is straighforward, there is not much terminology being
used as of now:
\begin{itemize}
\item DDS: Digital Distribution Service such as play store, microsoft play, etc.
\item OS: Operating System.
\item Python: The programming language used for application development.
\item Pygame: Computer graphics Python library.
\item Snake 2.o: The desktop application being developed in Python.
\item The interface: The graphics developed using Pygame.
\item The source game: The open source original Python snake game being used for this project.
\end{itemize}
\subsection{Relevant Facts and Assumptions}
Some factors that might affect the outcome of the product are listed as follows:
\begin{itemize}
\item DDS contribution will be necessary for the public release of the game.
\item Contribution of the development team will affect the outcome of the product.
\item Feedback from game testers.
\item Availability of resources from pygame library to replicate front-end design in HTML,CSS and JS.
\item Time remaining once initial objectives and goals are met. This could affect which additional functionality is added.
\end{itemize}
There are also assumptions that pertain to the intended operational environment and anything affecting the product:
\begin{itemize}
\item Pygame library offers enough functionality to recreate the web app graphics in Python.
\item The user is using Windows for game execution otherwise they must compile the source code to run the application.
\item The application will not be an exact replica of the source game. Added functionality and a change of graphics is expected.
\item The game application will prioritize the completion of the snake game as the central attraction.
\end{itemize}
Some user characteristics will affect the final deisgn and written requirements:
\begin{itemize}
\item Users expect the game to be responsive and timely due to the nature of wanting quick stimulus .
\item The game should have an attractive user inteface due to the nature of the users expectations. It is mainly used for entertainment and should
have a smooth user-interface.
\end{itemize}
\section{Functional Requirements}
\subsection{The Scope of the Work and the Product}
% Summarize Gantt Chart
\subsubsection{The Context of the Work}
%
The scope of the project is deliver a Product that has the requirement documentation, and a desktop application that can be installed on a user's system.\\
\\To achieve the goals of the Product, the following are decided to be the deadlines of the goal to be on the track:\\
$\bullet$ Development Plan \date{28/09/18}\\
\\$\bullet$ Requirements Document Revision \date{05/10/18}\\
\\$\bullet$ Proof of Concept Demonstration \date{16/10/18}\\
\\$\bullet$ Test Plan Revision \date{26/10/19}\\
\\$\bullet$ Design \& Document Revision \date{09/11/18}\\
\\$\bullet$ Revise all the Documentation \date{13/11/18}\\
\\$\bullet$ Final Documentation \date{06/12/18}\\
\subsubsection{Work Partitioning}
%breakdown your task into sub-task e.g. break logic and user interface
The desktop application involves different processes to successfully run: making a user-interface so the user can interact with the application, \textcolor{red}{Back-End Development} that can handle all the inputs given by the user and \textcolor{red}{updates the interface} according to the requirements.
These tasks can be divided into sub-task. For example, \textcolor{red}{the system uses a mouse as an input, so whenever the user presses a button on the interface from its computer's mouse, there is an update in the display making the user engaged to the application. Tasks such as displaying the food, making the snake appear at random locations, in the beginning, should all be divided and can be accomplished individually by the developers, this would be more efficient to complete the project, and the respective developer would know how to test the functions they created}.
\subsubsection{Individual Product Use Cases}
%
The user can use the system-to-be (the desktop application) to entertain themselves when they are bored. They can use the system to improve their response time, with playing the game in difficulty modes it can be more challenging and the user has to be fast. In addition, the desktop application would be a fun means of entertainment between friends as they can play turn-by-turn and challenge each other.
\subsection{Functional Requirements}
$\bullet$ Requirement number: FR(Functional Requirement)1\\
\textcolor{red}{When the user sees the interface, it can select the buttons on the screen by using the computer's mouse.}\\
$\bullet$ Requirement number: FR2\\
The user can press the UP key to move the snake's direction in the upwards direction.\\
$\bullet$ Requirement number: FR3\\
The user can press the DOWN key to move the snake's direction in the downwards direction.\\
$\bullet$ Requirement number: FR4\\
The user can press the LEFT key to move the snake's direction in the left direction.\\
$\bullet$ Requirement number: FR5\\
The user can press the \textcolor{red}{RIGHT} key to move the snake's direction in the right direction.\\
$\bullet$ Requirement number: FR6\\
The game should display the user's highest score.\\
$\bullet$ Requirement number: FR7\\
The initial location of the snake should be random whenever the user starts the game or when it restarts.\\
$\bullet$ Requirement number: FR8\\
The user has the option to play in three different modes: \textcolor{red}{easy, intermediate and advanced.}\\
$\bullet$ Requirement number: FR9\\
\textcolor{red}{The desktop application shall provide a facility to play the game in different themes, e.g., Dark or Light, or choose the random option to select either theme.}\\
$\bullet$ Requirement number: FR10\\
\textcolor{red}{When the snake eats its food, its length should be increased by 3 units. For instance, when the game is started the snake’s length is only 1 unit, but after eating a block of food, its new length should be 4 units.}\\
$\bullet$ Requirement number: FR11\\
\textcolor{red}{Once the snake eats its food, the food should reappear on the screen.}\\
$\bullet$ Requirement number: FR12\\
\textcolor{red}{When the user is playing the game in easy mode, the snake is allowed to move within the screen size and can pass the boundaries (the window screen edges), if the snake traverses the boundary it should reappear from the opposite direction.}\\
$\bullet$ Requirement number: FR13\\
\textcolor{red}{When the user is playing the game in either intermediate or advanced mode, the snake is allowed to move within the screen size and cannot pass the boundaries (the window screen edges), if the snake traverses the boundary it should die, and a message should prompt on the screen to restart the game.}
$\bullet$ Requirement number: FR14\\
\textcolor{red}{When the user is playing the game in advanced mode, the game shall offer a maze within the Gameplay to restrict the snake's location and make it more challenging.}
$\bullet$ Requirement number: FR15\\
If the snake bites itself, the game should be over and a message should prompt on the screen to restart the game.\\
$\bullet$ Requirement number: FR16\\
\textcolor{red}{The highest score of the user shall be saved in a text file.}\\
$\bullet$ Requirement number: FR17\\
\textcolor{red}{The user can view their highest score from the main menu by pressing the Highscore button.}\\
$\bullet$ Requirement number: FR18\\
\textcolor{red}{The color of the snake changes when a different theme is selected.}\\
\section{Non-functional Requirements}
\subsection{Look and Feel Requirements}
\subsubsection{Appearance Requirements :\textcolor{red}{NFR1}}
The final product shall be a desktop application which will contain a playground with a snake in it. It shall have different theme options and buttons to \textcolor{red}{select different modes to play with. In addition, there should be a help page for a new player in order to get familiar with the commands to play this game}. Also, it shall show the highest score made on the specific device.
\textcolor{red}{Fit Criterion: The game will be ran and checked if all the mentioned options pop up.}
\subsubsection{Style Requirements:\textcolor{red}{NFR2}}
The product should be given a modern style by adding a nice background to it with a user-friendly interface.
\textcolor{red}{Fit Criterion: The game will be ran and beta testing will be performed to check this.}
\subsection{Usability and Humanity Requirements:\textcolor{red}{NFR3}}
The application must be simple for a person aged 10 or above. It should be understandable by any person within the age group who is familiar to the technology. No feature should restrict the player to a non-knowledgeable outcome.
\textcolor{red}{Fit Criterion: People with different age group will be requested to play the game and rate it.}
\subsection{Performance Requirements}
\subsubsection{Speed Requirements:\textcolor{red}{NFR4}}
\begin{description}
\item[$\bullet$] All valid interaction should have a maximum response time of half a second.
\item[$\bullet$] The speed for snake should be customizable by the user and should not increase or decrease by itself.
\textcolor{red}{Fit Criterion: The buttons should respond within half a second and modes with different speed will be available.}
\end{description}
\subsubsection{Safety Critical requirements :\textcolor{red}{NFR5}}
The game shall not consume any private data from the user's device.
\textcolor{red}{Fit Criterion: The game can not interfere with user's private data}
\subsubsection{Precision Requirements :\textcolor{red}{NFR6}}
The turn for snake should match with the users key and should be done as precisely as possible.
\textcolor{red}{Fit Criterion: There should be no lag between the press of the button and snake's movement.}
\subsubsection{Reliability and Availability Requirements :\textcolor{red}{NFR7}}
The game should be available 24 hours, 365 days per year to the user.
\textcolor{red}{Fit Criterion: The game can be played any time of the day, on any day.}
\subsubsection{Capacity Requirements :\textcolor{red}{NFR8}}
The game shall not overload the clients device's memory.
\textcolor{red}{Fit Criterion: The game must not take more than 20MB of the users storage.}
\subsection{Operational and Environmental Requirements}
\subsubsection{Expected Physcial environment :\textcolor{red}{NFR9}}
The application is intended to be used anywhere, at any desktop device. It can be used in any climatic condition from harsh summers to chilly winter( given that the device is working as well).
\textcolor{red}{Fit Criterion: The game should work under any environmental conditions.}
\subsubsection{Expected Technological environment :\textcolor{red}{NFR10}}
This application should work on any desktop device as long as the device is working.
\textcolor{red}{Fit Criterion: The game should work on all the working devices supported by the software.}
\subsection{Maintainability and Support Requirements}
\subsubsection{Maintainability :\textcolor{red}{NFR11}}
The application shall require minimum maintenance. Also, the application shall be revised every year. \textcolor{red}{Also, the code should be heavily commented in order to provide ease to the developer/maintainer.}
\textcolor{red}{Fit Criterion: Doxygen commenting should be done to ease maintainability.}
\subsubsection{Portability :\textcolor{red}{NFR12}}
The application is expected to run on Windows, Mac OS and Linux environment.
\textcolor{red}{Fit Criterion: The game must run on MacOD, Windows and Linux.}
\subsection{Security Requirements :\textcolor{red}{NFR13}}
This is an open-ended application. However, the application must not break the privacy policy by interfering with files stored on the desktop.
\textcolor{red}{Fit Criterion: The system can not interfere with user's privacy}
\subsection{Cultural Requirements :\textcolor{red}{NFR14}}
The application will not use any kind of communicating data that will offend any religion, country or user in any way. The product will give a detailed explanation in case of use of any cultural or political symbol.
\textcolor{red}{Fit Criterion: The system must not contain anything that can offend any subject.}
\subsection{Legal Requirements :\textcolor{red}{NFR15}}
The application shall comply with all national and federal laws. In addition, the application must agree to the MIT Open License.
\textcolor{red}{Fit Criterion: The system must obey laws and have an open License.}
\subsection{Health and Safety Requirements :\textcolor{red}{NFR16}}
\textcolor{red}{This software should not affect the health of the user by any means. Color contrast ratio between colors used in the game is at a minimum of 4.5:1 according to G18 of the W3C Web Content Accessibility Guidelines 2.0}
\textcolor{red}{Fit Criterion: The system must not harm an individuals health in any way.}
\section{Project Issues}
\subsection{Open Issues}
Below is a list of open issues pertaining to the project scope:
\begin{itemize}
\item Investigating and understanding the capabilities of the Pygame library is yet to be completed.
\item Integrating additional features is not decided on as of yet. It is dependant on time constraints.
\item snake-game multiplayer mode is an open issue on the open source project which we may or may not choose to implement as time permits.
\end{itemize}
\subsection{Off-the-Shelf Solutions}
Although there are available solutions on developing such a game, the project team is aiming to enhance the game by producing a desktop version with
added functionality.
Ready-made simple implementations of the projects are available and can be used as reference but otherwise, enhanced features will have to be created from scratch (light/ dark theme, custom player settings, high scores and so on).
\subsection{New Problems}
\subsubsection{Effects on the Current Environment}
The Microsoft Store contains the "250k snake" app for windows, an implementation of the old-school snake game. Aside from this application, other applications that appear when searching "snake" or "snake game" do not reflect the classical snake game. By developing the snake game as a desktop app, we will be able to provide game shoppers with more options to pick from.
\subsubsection{Effects on the Installed Systems}
The existance of the 250k snake will make it difficult to push the project team's implementation of the game, Snake 2.o, into the microsoft store market successfully. However, the new snake game will fill a niche for cutsomizability by allowing users to pick from many different settings.
\subsection{Tasks}
An article on linkedIn by Sumit Jain summarizes the steps involved in the game development process [ ~\cite{devArticle} ]. In his article, he outlines 6 main steps to the game development cycle: Idea \& Story, Conceptualize \& Design, Technical Analysis, Development, Testing, Deployment. Considering the project scope and the redevelopment of the snake game, the main three steps involved in the developement cycle are the following:
\begin{itemize}
\item Technical Analysis: Use reverse engineering to understand how the game was originally built and analyze the main modules/ framework used to develop the game.
\item Development: Using Python and Pygame to develop the source code for the game; Analysis from the previous step will be necessary to break down the developement process.
\item Testing: Test using unittest in python and principles of white box and black box testing. In further developments, this would also include intergation testing with the user interface and the collection of modules created for the application.
\end{itemize}
Project members should expect the development cycle to resemble the previously mentioned framework. Once the cycle has been iterated until completion of Snake 2.o, the team will move on to the deployment stage, considering options for making the game available on a DDS such as the Microsoft Store.
\subsection{Migration to the New Product}
Snake 2.o will be require the following conversion tasks:
\begin{itemize}
\item Converting JS,HTML and CSS graphics and animations to Pygame graphics.
\item Comverting the source project into modularized step-based tasks.
\item Converting from JS,HTML and CSS source code to Python source code.
\end{itemize}
The source project will be run with Snake 2.o for performance comparison and visual feedback on the accuracy of the redevelopment as well as the enhance features that were added to snake 2.o.
\subsection{Risks}
Snake 2.o will be a classical desktop application and therefore does not present many risks to the user or any stakeholders involved. In terms of taking risk to advance the project, there is risk in striving for the completion of a multiplayer mode for the game since it may take substantial time and effort. However, this risk is low since the project requirements have already been met and other features of the game have been enhanced, aside from the addition of a multiplayer mode.
In the case that more risks are perceived in the future, the project team will take the following course of action to come up with early warnings:
\begin{itemize}
\item If the development is taking place 1 week prior to the project deadline, an early warning will be issued and the group must decide to continue or dismiss the development.
\item If the development is currently taking place with 2 weeks left until the project deadline and less than 50\% of the development is in place, it will be dismissed.
\item If the main project is missing any component (testing, code modularization, documentation, commenting, etc.) no development will proceed until the main requirements (minimum requirements) are met.
\item If any of the main project components are deemed to have lower quality, a warning is issued and the team members must discuss whether to continue with further development or improving the existing product.
\end{itemize}
\subsection{Costs}
As mentioned in the development plan document, team members will be dedicating 2 hours outside of lab time for team meetings and discussions along with 5 hours of individual work on the project itself. Since the project is open source and uses open libraries such as Pygame, the monetary cost is \$0. However, there may be additional costs to publishing Snake 2.o with a DDS.
\subsection{User Documentation and Training}
The user will be provided with the following documentation and training:
\begin{itemize}
\item Snake 2.o User Manual: The document will explain the basic permisses of the game, user settings, graphic themes, menu headings, and any other information necessary for the user to understand the features of the game.
\item Snake 2.o Installation Manual: Provided that the user will not be using Windows or the native OS that is decided on, this document will provide simple installation instructions for compiling the code on different OS's.
\end{itemize}
\subsection{Waiting Room}
In future releases of the project, the following requirements might be included in the revised requirements document:
\begin{itemize}
\item Snake 2.o User Manual - Multiplayer Mode: A section explaining how to connect and play the snake game with friends
\item additional 'multiplayer mode' module: A separate module to encapsulate the multiplayer mode
\item additional 'themes' module - a module encapsulating the different graphic themes available for the game
\end{itemize}
\subsection{Ideas for Solutions}
Some rudimentary ideas for project modules and solutions have been mentioned down below:
\begin{itemize}
\item Classes/modules for individual objects like the snake, food block, the frame, the menu bar, the settings bar and so on.
\item import graphics developed in adobe illustrator into the game as characters, props and so on.
\item the snake class can have method that correspond to the snakes functionality such as moveLeft, moveRight, moveUp, moveDown, and Lengthen.
\item the food item can have a randomPlacement method for when being placed at random around the window.
\item UI: a custom header section can contain the entry fields for custom speed and other important parameters.
\end{itemize}
\bibliographystyle{plainnat}
\newpage
\section{Appendix}
NA
\subsection{Symbolic Parameters}
NA
\end{document}
\ No newline at end of file
# Development Plan
# Test Plan
The folders and files for this folder are as follows:
......
File added
\documentclass[12pt, titlepage]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{url}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue
}
\usepackage[round]{natbib}
\title{SE 3XA3: Test Plan\\Snake 2.o}
\author{Team 30, VUA30
\\ Andy Hameed and hameea1
\\ Usman Irfan and irfanm7
\\ Vaibhav Chadah and chadhav
}
\date{\today}
\begin{document}
\maketitle
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\begin{table}[bp]
\caption{\bf Revision History}
\begin{tabularx}{\textwidth}{p{3cm}p{2cm}X}
\toprule {\bf Date} & {\bf Version} & {\bf Notes}\\
\midrule
10/25/2018 & 1.0 & Usman added section 3.1, Vaibhav added section 3.2, Andy added section 4. \\
10/26/2018 & 1.0 & Andy added section 1 and 7, Vaibhav added section 2 and 5, Usman added section 6.\\
\textcolor{red}{12/2/2018} & 1.1 & Vaibhav is doing the revision 1 in order to improve the documents quality\\
\textcolor{red}{12/2/2018} & 1.1 & Usman is doing the revision 1 in order to improve the documents quality\\
\bottomrule
\end{tabularx}
\end{table}
\newpage
\pagenumbering{arabic}
\section{General Information}
\subsection{Purpose}
Testing will be conducted to ensure that the software meets the requirements set in the original development as well as the new requirements that are set as enhancements to the original game. The generated test cases will also serve as guiding rules for developing code using TDD.
The reinvention of the Snake game as Snake 2.o will involve new features such as custom speed, high score menu, customizable themes and a multiplayer mode if time permits. These new features, along with the requirements set for the original implementation of the game will be tested to detect any bugs or errors. The use of the Pygame library allows for a GUI that will enable integrated and system testing. Peers will be able to demo the game and catch any errors or bugs by doing so. White box testing will be used as well on the existing code that was used for the POC demonstration. Automated testing will be implemented using the unittest framework built into Python. Aspects that have not yet been implemented or would be hard to detect visually, like for example the speed of the moving snake, will be tested using static analysis along with automated testing.
\subsection{Scope}
Testing will cover all of the behaviours mentioned below. Note that this is a general overview and more details are provided further on in the document.
The expected behaviour is to have a menu that leads to the game screen. Once the game is initiated, the objective is for the snake to eat the food block and continue doing so until the snake dies. Each time the snake eats, the score should increase by one and the length of the snake body should increase by some predetermined number of blocks. The snake dies if it runs into itself by looping around its body or by hitting the edges of the game window.
Looking at the Git respository for the original game, there are no test modules that can be seen so the test cases will be based on any test cases generated by the three team members.
\subsection{Acronyms, Abbreviations, and Symbols}
\begin{table}[hbp]
\caption{\textbf{Table of Abbreviations}} \label{Table}
\begin{tabularx}{\textwidth}{p{3cm}X}
\toprule
\textbf{Abbreviation} & \textbf{Definition} \\
\midrule
T1D1 & Test 1 ID 1\\
TDD & Test-Driven Development\\
POC & Proof of Concept\\
GUI & Graphical User Interface\\
N/A & Not Applicable\\
\bottomrule
\end{tabularx}
\end{table}
\begin{table}[!htbp]
\caption{\textbf{Table of Definitions}} \label{Table}
\begin{tabularx}{\textwidth}{p{3cm}X}
\toprule
\textbf{Term} & \textbf{Definition}\\
\midrule
Pygame & open source Python library used to create game graphics\\
White Box testing & a method of testing where the code is examined in order to create the test cases. This mostly corresponds to testing functional requirements based on the description of functions and methods in each component module\\
Black Box testing & a method of testing where the code is not examined in order to create the test cases. This mostly corresponds to non-functional requirements\\
Test Driven Development& a method of developing software using a set of test cases that are written prior to the code itself. The test cases can identify how functions and methods should behave\\
PyUnit& Testing framework for python software development\\
\bottomrule
\end{tabularx}
\end{table}
\subsection{Overview of Document}
The document will summarize the test cases that will be conducted on Snake 2.o, a remake of the orignal snake game using Python and the Pygame library. Several testing techniques are used including automated testing, white box testing, black box testing, manual testing, integration and system testing and static analysis. The document will outline the plan for testing, a description of the test system with non-functional and functional test cases, unit testing and POC testing, and other details pertaining to the testing of Snake 2.o.
\section{Plan}
\subsection{Software Description}
The software will act as a medium of entertainment to the users. It is a snake game with added functionality such as different speed and theme options. The implementation of this software is done using Python.
\subsection{Test Team}
The individuals responsible for testing are Vaibhav Chadha, Usman Irfan and Andy Hameed. Each person will be responsible for testing one's own work. For example, Vaibhav is working on the Graphical User interface of the main screen, hence is responsible for testing it. Usman and Andy will be collaboratively working on the snake game ( which includes recording highest score, current score, snake movement etc.) and will be responsible for testing them likewise.
\subsection{Automated Testing Approach}
One of the more difficult parts of testing the software will be manual testing. The reason behind this is that a game can be tested better when played as the user can see errors and delays better.
However, automated testing will also be done in order to check certain functionality of the software. For this, PyUnit testing will be used.
\subsection{Testing Tools}
PyUnit testing will be used as a testing tool for this program.
\subsection{Testing Schedule}
See \href{https://gitlab.cas.mcmaster.ca/hameea1/se3xa3/tree/master/BlankProjectTemplate/ProjectSchedule}{Gantt Chart} for details about the testing schedule
\section{System Test Description}
\subsection{Tests for Functional Requirements}
\begin{enumerate}
\subsubsection{Testing Functions \& Methods}
\item{\textbf{TID1}\\}
\textcolor{red} {Type: Functional, Dynamic, manual\\
Initial State: The desktop application starts waiting for the user to select a game mode to begin.\\
Input: The user selects one of the game modes from the main menu.\\
Output: The desktop application moves to the next page by displaying the themes.\\
How the test will be performed: The test will be done dynamically, that means once the program will be executed the tester would select a difficulty level and see if the page gets updated by displaying different themes.}
\item{\textbf{TID2}\\}
Type: Functional, Dynamic, Manual
\textcolor{red} {Type: Functional, Dynamic, manual\\
Initial State: The desktop application is at the theme mode and requires user input to select an input and display the game mode.\\
Input: The user selects one of the themes from the theme page interface.\\
Output: The desktop application moves to the next page by displaying the gameplay interface.\\
How the test will be performed: The test will be done dynamically, that means once the program will be executed the tester would select a theme and see if the page gets updated by displaying the gameplay.}
\item{\textbf{TID3}\\}
Type: Functional, Dynamic, Manual
\textcolor{red} {Type: Functional, Dynamic, manual\\
Initial State: The desktop application executes and displays a ``Highscore" button on the bottom left of the main menu.\\
Input: The user selects the ``Highscore" button.Output: The desktop application moves to the next page by displaying the gameplay interface.\\}
Output: The application would display the highest score of the user from the day they started to play till the present date.
How the test will be performed: The test will be done dynamically, that means once the program will be executed the tester would select a theme and see if the page gets updated by displaying the gameplay.
\item{\textbf{TID4}\\}
Type: Functional, Dynamic, manual
Initial State: The desktop application starts waiting for the user to enter a command to begin.
Input: The user presses any button key.
Output: The desktop application begins moving the snake towards the respective direction.
How the test will be performed: The test will be done dynamically, that means once the program will be executed the developer will press any key to see if it would run the game, making the snake move.
\item{\textbf{TID5}\\}
Type: Functional, Dynamic, Manual
Initial State: The desktop application executes and displays the snake at a random location.
Input: NULL
Output: The snake displays the snake at random location when played the next time.
How test will be performed: The user can track the location of the snake the first time the game is played. The game should be restarted to ensure that the snake's position changes every time the game starts.
\item{\textbf{TID6}\\}
Type: Functional, Dynamic, Manual
Initial State: The snake's food is at a random location.
Input: NULL.
Output: The food reappears on the screen at a random location when the snakes eat the previous one.
How test will be performed: The developer will test this requirement by moving the snake's head location equal to the food's location. When the snake eats the food, instantly another food should display on the screen at a random location.
\subsubsection{Testing of Keyboard/Mouse Interactions}
\item{\textbf{TID7}\\}
Type:Functional, Dynamic, Manual
Initial State: The game waits for the user to press a direction key to move the snake.
Input: The user presses UP key.
Output: The snake in the game would moves up by one-unit length.
How test will be performed: The test will be done dynamically, that means once the program will be executed the developer will press the UP key to test if the snake moves in the upward direction.
\item{\textbf{TID8}\\}
Type: Functional, Dynamic, Manual
Initial State: The game waits for the user to press a direction key to move the snake.
Input: The user presses DOWN key.
Output: The snake in the game would moves down by one-unit length.
How test will be performed: The test will be done dynamically, that means once the program will be executed the developer will press the DOWN key to test if the snake moves in the downward direction.
\item{\textbf{TID9}\\}
Type: Functional, Dynamic, Manual
Initial State: The game waits for the user to press a direction key to move the snake.
Input: The user presses LEFT key.
Output: The snake in the game would moves left by one-unit length.
How test will be performed: The test will be done dynamically, that means once the program will be executed the developer will press the LEFT key to test if the snake moves in the left direction.
\item{\textbf{TID10}\\}
Type: Functional, Dynamic, Manual
Initial State: The game waits for the user to press a direction key to move the snake.
Input: The user presses RIGHT key.
Output: The snake in the game would moves right by one-unit length.
How test will be performed: The test will be done dynamically, that means once the program will be executed the developer will press the RIGHT key to test if the snake moves in the right direction.
\item{\textbf{TID11}\\}
Type: Functional, Dynamic, Manual
Initial State: The desktop application executes and displays three modes to be played.
Input: Mouse Cursor
Output: The application should open the specific mode the user has requested to play.
How test will be performed: Different modes in the game will be opened using the mouse cursor, their display or speed should be different from other modes. Easy having the slowest speed and allowing the snake to exit from the one-direction boundary and enter from the other direction of the boundary (e.g. leaving from right side boundary and entering from the left side boundary). While playing the hard mode, the speed should be much faster than the Easy mode, and would not allow the snake to cross the boundary. If the snake touches the boundary the snake should die and terminating the game.
\item{\textbf{TID12}\\}
Type: Functional, Dynamic, Manual
Initial State: The initial length of the snake would be one-unit length.
Input: The user presses the Direction keys to control the snake
Output: The length of the snake should not equal to one-unit length when it dies (Hard mode would be an exception).
How test will be performed: The developer moves the snake by pressing the direction keys. When the snake's head location equals the food location, its length should be increased by five unit-length. When the snake dies its increase in length \textcolor{red}{its length should be increased by three unit-length}.
\subsubsection{Testing Game Ending}
\item{\textbf{TID13}\\}
Type: Functional, Dynamic, Manual
Initial State: The snake is not one-unit length.
Input: NULL.\\
\textcolor{red}{Output: The screen displays a screen biting itself, and a message prompts on the screen with various options to allow the user to play the game again or go to the main menu.\\
How the test will be performed: The developer will test this requirement by moving the snake’s head location to the snake’s body location. When the snake eats its body the snake’s movement should stop and will be able to see the error message.}
\end{enumerate}
\subsection{Tests for Nonfunctional Requirements}
\subsubsection{Look and Feel}
\begin{enumerate}
\item{\textbf{TID17}\\}
Type: Structural, Dynamic, Manual
Initial State: The game should be installed on the device.
Input/Condition: The game is opened and ran on the device.
Output/Result: The User Interface should open with different buttons, alongside with a playground with a snake in it.
How the test will be performed: The program will manually run on the device and checked by the human eye to see if it meets the criteria.
\end{enumerate}
\subsubsection{Usability}
\begin{enumerate}
\item{\textbf{TID18}\\}
Type: Structural, Dynamic, Manual
Initial State: The program will be running for a human nearing 10 years of age or above
Input/Condition: The program will be set on its default settings
Output/Result: The person testing should be able to understand the game and play it. He/she should be able to customize themes and speed of the game.
How the test will be performed: A younger human of nearing age 10 will be asked to operate this game and recorded if he/she is able to operate it successfully or not.
\end{enumerate}
\subsubsection{Performance}
\begin{enumerate}
\item{\textbf{TID19}\\}
Type: Functional, Dynamic, Manual
Initial State: The program will be running with the main user interface open.
Input/Condition: The button is pressed.
Output/Result: The response time for button should be less than half a second.
How the test will be performed: It will be performed using human actions. The response would be times to be as precise as possible. Also, it will be taken into consideration that the user doesn't have to wait for a long observable time.
\item{\textbf{TID20}\\}
Type: Structural, Dynamic, Manual
Initial State: The snake Game will be running on the device.
Input/Condition: \textcolor{red}{Different modes will be played}.
Output/Result: \textcolor{red}{Snake's speed variation will be observed between different modes.}
How the test will be performed: \textcolor{red}{The game will be played with selecting 1 of the 3 different levels. Then, the speed difference will be observed as the game progresses through. Also, it will be taken care that the game goes at constant speed within a specific level.}
\item{\textbf{TID21}\\}
Type: Structural, Dynamic, Manual
Initial State: The snake Game will be running on the device.
Input/Condition: The snake will be moving around and keys will be pressed to change directions.
Output/Result: Snake should change directions promptly.
How the test will be performed: While the game is going on, the buttons will be pressed to change the direction of the snake.
\end{enumerate}
\subsubsection{Operational and Environmental}
\begin{enumerate}
\item{\textbf{TID22}\\}
Type: Structural, Dynamic, Manual
Initial State: The program will be moved on a USB.
Input/Condition: The USB will be inserted into any other working computer/ Desktop.
Output/Result: The game should be able to run on it as long as the device is powered and in working state.
How test will be performed: Many different laptops, alongside with desktops, will be used to test. The game will be played on different devices with different specifications to make sure that the game is playable regardless of the specs of the device.
\end{enumerate}
\subsubsection{Maintainability and Support Requirements}
\begin{enumerate}
\item{\textbf{TID23}\\}
Type: Functiona Dynamic, Manual
Initial State: The program will be moved to a Windows, Mac OS and Linux operating devices.
Input/Condition: The program will be executed.
Output/Result: The game should run.
How test will be performed: The game will be taken and transferred to the systems operating on different OS's. For this, the target is Windows device, Mac OS device and a Linux Device.
\end{enumerate}
\subsubsection{Security and Cultural}
\begin{enumerate}
\item{\textbf{TID24}\\}
Type: Structural, Dynamic, Manual
Initial State: The program will be running.
Input/Condition: All the interfaces running.
Output/Result: No offensive or illegal content on the entire application.
How test will be performed: The application will be executed and each page and option will be approached to make sure there is no offensive or illegal content. Also, there is a Static module to this requirement where all the files (including code) will be looked to make sure about no offensive or illegal content.
\end{enumerate}
\section{Tests for Proof of Concept}
The POC consists of a simple demonstration of the moving snake in the game window along with a start menu. The food item will not be created in the demo, instead, the testing will only involve the movement of the snake and the main menu that has been created at the start of the game.
\subsection{Snake Dynamics}
\paragraph{Snake Movement and Speed}
\begin{enumerate}
\item{\textbf{TID25}\\}
Type: Dynamic
Initial State: The snake body - graphically represented by a red square - is initially motionless. It exists somewhere within the frame of the window.
Input: Keyboard Event - user clicks on one of the directions on the keyboard arrow pad.
Output: Snake moves according to the direction chosen. This can logically represented by the expression keyboardEvent.direction == snakeMovementDirection. Note that the variables used are arbitrary and are dependant on Python syntax.
How test will be performed:
\begin{itemize}
\item A method will be created under the POC test class where the keyboard event is manually set to the code representing each of the directions on the arrow keypad - up, down, left and right. The direction inserted will be asserted equal to the direction of the moving snake, set by some variable.
\item After starting the game, the user will click on each one of the four directions and verify whether or not the snake is moving in the corresponding direction, using the graphical interface created with Pygame.
\end{itemize}
\item{\textbf{TID26}\\}
Type: Dynamic, Functional testing
Initial State: The snake body - graphically represented by a red square - is initially motionless. It exists somewhere within the frame of the window.
Input: Keyboard Event - user clicks on one of the directions on the keyboard arrow pad.
Output: Snake moves accurately according to the speed set in the snake module. Statically, this can represented for the vertical movement of the snake by this expression:
\begin{align*}
(snakeFinalPosition - snakeInitPosition) == (speed \times timeElapsed)*vel
\end{align*}
where vel is the distance defined for 1 single step and speed is the delay between each step in milliseconds
How test will be performed: A method will be created under the POC test class where the keyboard event is manually set to the code representing each of the directions on the arrow keypad - up, down, left and right. The logical expression above is implemented into an assert statement verifying that the distance moved corresponds to the speed and velocity that were used as well as the time that has elapsed - this can be obtained from the time object in Pygame.
\end{enumerate}
\subsection{Integration and System Testing}
\begin{enumerate}
\item{\textbf{TID27}\\}
Type: Integration, System testing
Initial State: The game menu is loaded onto the window with options for starting the game and quitting the game.
Input: The following sequence of inputs
\begin{enumerate}
\item User clicks start game
\item Keyboard Event - user clicks on one of the directions on the keyboard arrow pad.
\item user exits the window by clicking the exit tab on the top right corner of the screen
\end{enumerate}
Output: Snake game runs as intended. The "start game" option leads the user to the game screen where the snake body sits motionless. The user moves the snake body using the keyboard arrow pad, moving in directions that correspond apprioriately to the arrows clicked and in the correct sequence. The game window is closed once the user clicks the exit button on the top right corner.
How test will be performed: Several peers will be asked to test the game from start to finish for this integration and system test.
\end{enumerate}
\section{Comparison to Existing Implementation}
Currently, we have the following tests that compare to the existing comparison:
\begin{enumerate}
\item TID3 : In the Proof of Concept, it has already been tested that the snake appears at a random position everytime a new game is played.
\item TID6, TID7, TID8, TID9 : In the code, its already tested that the snake moves in the direction of the button pressed as soon as it is pressed.
\item TID19 : The current code for the game meets the requirement as it launched the operation of a button as soon as it is pressed. For this, the "Play Game" button and "Quit" button has been tested.
\item TID23 : The present code was transferred on windows and Mac OS devices and was working completely fine.
\item TID25 : All the mentioned testing has been done for the POC.
\end{enumerate}
\section{Unit Testing Plan}
The PyUnit testing framework would be used to test our desktop application.
\subsection{Unit testing of internal functions}
The PyUnit testing framework will be used to test our source code's functions, this is an automated testing unit, and it provides classes which can ease different testing functions. By using PyUnit we can check the robustness of our program, if wrong inputs are given will the program be able to handle such cases without crashing. Besides, the requirement of the program can be tested to see if our program matches with the functional and non-functional requirements of the program.
\subsection{Unit testing of output files}
The testing of the output files through unit testing will tell the developers if all the test cases designed by them run efficiently. The snake's movement would be compared to the actual output if the user is pressing the UP key and the snake is moving in the respective direction it would pass the unit testing. Testing the output files can also help us to find that if different modes of the game are selected then different rules of the games should be followed. The game being played in the Hard mode could be tested that the snake is not allowed to cross boundaries and this could be compared with automated testing allowing us to know if our output files have passed their unit test.
\newpage
\section{Appendix}
\subsection{Symbolic Parameters}
N/A
\subsection{Usability Survey Questions?}
The following questions will be asked to peers when conducting integrated and system testing:
\begin{itemize}
\item Does the game lag at any point?
\item Does the game maintain consistent speed performance as you advance through the game?
\item Is the main menu clear and understandable?
\item Is the game exciting to play?
\item Is the game visually appealing? Does it look visually complete?
\end{itemize}
Other questions will be asked to validate the game, mostly focusing on non-functional requirements whose completeness is subjective to the user.
\end{document}
\ No newline at end of file
# Test Report
The folders and files for this folder are as follows:
Describe ...
File added
\documentclass[12pt, titlepage]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{graphicx}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue
}
\usepackage[round]{natbib}
\title{SE 3XA3: Test Report\\Snake 2.o}
\author{Team \#30, VUA30
\\ Usman Irfan - irfanm7
\\ Andy Hameed - hameea1
\\ Vaibhav Chadha - chadhav
}
\date{\today}
\begin{document}
\maketitle
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\begin{table}[bp]
\caption{\bf Revision History}
\begin{tabularx}{\textwidth}{p{3cm}p{2cm}X}
\toprule {\bf Date} & {\bf Version} & {\bf Notes}\\
\midrule
2018-12-04 & 1.0 & Andy worked on 5 - how Intergrated \& System testing helped the process \\
2018-12-05 & 1.0 & Usman worked on Functional Requirements \& tracing the requirements to the test \\
Date 2 & 1.1 & Notes\\
\bottomrule
\end{tabularx}
\end{table}
\newpage
\pagenumbering{arabic}
\section{Functional Requirements Evaluation}
Through the strategy of dynamic testing, the main testing for the requirements was done. Most of the functional requirements were met, and the errors that were found during the execution were fixed. The project was demonstrated to different peers, and with the help of their review, the project was molded to achieve all the functional requirements described in SRS. \\
During the testing, we found the food usually appears within the snake's body which violated one our functional requirements, so to resolve the issue we used boundary conditions to limit the appearance of the food within the gameplay screen. After making the snake and food display on the screen, we found a bug that the snake's body is not aligned with the food most of the time, we changed the code, so the game is divided into rows and columns with the block size equal to the size of the snake and food. Splitting the screen in grids made the food to reappear within a grid, and the snake could easily eat it making our further implementation easy.
\section{Nonfunctional Requirements Evaluation}
\subsection{Usability}
\subsection{Performance}
\subsection{etc.}
\section{Comparison to Existing Implementation}
This section will not be appropriate for every project.
\section{Unit Testing}
\section{Changes Due to Testing}
Through integrated and system testing, which encompassed the majority of the testing done on the software, the user interface as well as bugs and errors in the gameplay were modified to fix erroneous properties of the software. By continuously executing the game, it was easy to estimate changes in object coordinates within the interface. For example, the menu buttons were arranged through trial and error by testing the software continuously until the desired look was acheived. Beyond that, system and intergrated testing confirmed that all modules were working correctly and any change in one of the modules did not affect the function of other modules through dependency relations.
Similarly, the gameplay was tested and verified by the developers of the software as well as peers and classmates to ensure proper functioning. Through feedback received in the google survey, errors and modifications were made: For example, one user suggested an excitement element to be added to the game and a maze feature was added to the advanced difficulty gameplay mode to accomodate for that. As seen in Figure 1, feedback received from peers included both functional and non-functional properties and aided in the software revision process.
\begin{figure}
\includegraphics[width=\linewidth]{feedback.png}
\caption{Peer Feedback \& Comments}
\end{figure}
\section{Automated Testing}
The main testing for this program was done through dynamic testing whcih has been discussed in the requirements. The validation
for the testing of the product was done by peer review, surveys and self-testing. Boundary cases and groups of test cases were used in dynamic testing to visualize the output and fix it.
\section{Trace to Requirements}
To meet the functional and non-functional requirements for the program, the requirements were divided into groups and modular
were created for each group. A module for the high score part was made in which the requirements for displaying the highest score, displaying the highest score and storing it was done.\\
Moreover, a theme module was made to meet the requirements regarding the selection of the theme. The user could select two types of themes from the main menu and then the gameplay would have a background of that color, with different themes the color of the snake changes.\\
To focus on the major requirements, most of the requirements were accomplished in the Gameplay and Interface module. Gameplay module was responsible for all the code in the backend. Requirements controlling the snake, altering the speed for the snake, checking boundary conditions for each level in the game was done in this module.\\
The interface module is more focused on the frontend, it visualizes the backend program to a user-interface which increases usability and allow the user to communicate with the program easily.ted for each group. A module for the highscore part
\section{Trace to Modules}
Integrated testing can visibly be traced back to the modules created. The main interface uses the Interface module along with GUI module for interface text and buttons. It is connected to the highscore module and theme module through the highscore and difficulty level buttons respectively. It also connected to the help module through the Help button. If any of these buttons is clicked and an error is released, the error can be traced back with ease depending on the button that was clicked prior to the malfunction.
This same pattern is applied in the theme module, between the regular, dark and random modes. Each button corresponds to color and setup parameters that reflect the chosen theme. If a specific them is not working, it can be traced back in the theme module through the commented blocks of code corresponding to each respective theme.
In the gameplay module, testing can be traced back based on user action and system response. Through the use of commenting it is visible to identify particular functionality such as snake direction change, detection of barrier collisions, snake body collisions, collision with a food block and so on. The traceability of malfunctioning parts within the actual game can be traced back within the gameplay module, which encompasses all functionality under which the snake game operates.
\section{Code Coverage Metrics}
\bibliographystyle{plainnat}
\end{document}
\ No newline at end of file
BlankProjectTemplate/Doc_Revision1/TestReport/feedback.PNG

51.6 KiB

#standard set up
import pygame
from random import randint
pygame.init()
#setting width and height of window
screen_x = 500
screen_y = 500
win = pygame.display.set_mode((screen_x,screen_y))
pygame.display.set_caption("My Game")
white = (255,255,255)
black = (0,0,0)
x = randint(40,400)
y = randint(40,400)
width = 20
height = 20
vel = 10
speed = 40
# 0 - (- direction) , 1 - (+ direction)
direction = 0
# 0 - x-axis , 1 - y-axis
axis = 0
run = True
while run:
pygame.time.delay(speed) #create a delay to prevent any unwanted behaviour
#events are anything that happens from the user
#we loop through the list of events that happen by the user's actions
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
#Each event type has an integer assigned to it. KEYDOWN has the code 2
if event.type == pygame.KEYDOWN:
if (event.key == pygame.K_LEFT):
axis = 0;direction=-1
if (event.key == pygame.K_RIGHT):
axis = 0;direction=1
if (event.key == pygame.K_UP):
axis = 1;direction=-1
if (event.key == pygame.K_DOWN):
axis = 1;direction=1
#Snake moving depending on axis and direction
if (axis):
y += vel*direction
else:
x += vel*direction
if x < 0:
#x = 0
x = screen_x - height
if y < 0:
#y = 0
y = screen_y - width
if y > screen_y - width:
#y = 500 - width
y = 0
if x > screen_x - height:
#x = 500 - height
x = 0
win.fill(white)
#all colors are defined in RGB with Pygame
pygame.draw.rect(win,(255,0,0), (x,y,width, height))
#we have to update the display to see the drawing of our object. Since it does
#not automatically update
pygame.display.update()
#Quit the game
pygame.quit()
#importing necessary libraries
import pygame, sys
#a function made to execute other files from the system
def runfile(runfilename):
with open(runfilename,"r") as rnf:
exec(rnf.read())
pygame.init()
#while loop required to always refresh the page
while True:
game = pygame.display.set_mode((800, 610))
game.fill([213, 219, 219])
mousepos = pygame.mouse.get_pos() #checking mouse position
mouseclick = pygame.mouse.get_pressed()#checking mouse pressed
pygame.display.set_caption("Lets Play")
title_font = pygame.font.SysFont("monospace", 80)
#Adding the title
gamename = title_font.render('SNAKE GAME', True, (255, 0, 0))
game.blit(gamename,(150,80))
#Adding the play game button
if (270 <= mousepos[0] <= 270+250 and 505 <= mousepos[1] <= 555 ):
#checks if the mouse is hovering over the button
pygame.draw.rect(game,[100,100,100], [270,505,250,50], 0)
#checking if the button is clicked
if mouseclick[0] == 1:
runfile('Snake_2.o_Demo.py')
else:
pygame.draw.rect(game,[180,180,180], [270,505,250,50], 0)
playgame_font = pygame.font.SysFont("comicsansms", 40)
gamebutton = playgame_font.render('GAME TIME', True, (0, 0, 200))
game.blit(gamebutton,(275,500))
#Taking user name
UserName = playgame_font.render('NAME:', True, (0, 250, 0))
game.blit(UserName,(50,200))
#Asking user for theme
ThemeOption = playgame_font.render('THEMES:', True, (0, 200, 0))
game.blit(ThemeOption,(50,300))
#Asking user for speed
SpeedOption = playgame_font.render('SPEED:', True, (0, 150, 0))
game.blit(SpeedOption,(50,400))
#If user wants to quit
pygame.draw.rect(game,[180,180,180], [650,550,130,55], 0)
Quit = playgame_font.render('QUIT', True, (0, 0, 0))
game.blit(Quit,(650,550))
if ( 650 <= mousepos[0] <= 650+130 and 550 <= mousepos[1] <= 550 +55):
#checks if the mouse is hovering over the button
#checking if the button is clicked
if mouseclick[0] == 1:
#print ("quiting")
#pygame.display.quit()
pygame.quit()
sys.exit()
pygame.display.update()
# Project Name
# Snake 2.o
This folder contains the project schedule Gantt Chart.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?><project name="3XA3: Team Project" company="" webLink="http://" view-date="2018-11-02" view-index="0" gantt-divider-location="300" resource-divider-location="300" version="2.8.9" locale="en_CA">
<description><![CDATA[Developing the clasical Snake game using python and front-end development languages.]]></description>
<view zooming-state="default:1" id="gantt-chart">
<field id="tpd3" name="Name" width="163" order="0"/>
<field id="tpd4" name="Begin date" width="67" order="1"/>
<field id="tpd5" name="End date" width="66" order="2"/>
<option id="color.recent"><![CDATA[#cc0000 #ff9933 #66ffff #ff3333 #6600cc #99ff66 #33ff33 #ffcc33 #6666ff]]></option>
</view>
<view id="resource-table">
<field id="0" name="Name" width="210" order="0"/>
<field id="1" name="Default role" width="86" order="1"/>
</view>
<!-- -->
<calendars>
<day-types>
<day-type id="0"/>
<day-type id="1"/>
<default-week id="1" name="default" sun="1" mon="0" tue="0" wed="0" thu="0" fri="0" sat="1"/>
<only-show-weekends value="false"/>
<overriden-day-types/>
<days/>
</day-types>
</calendars>
<tasks empty-milestones="true">
<taskproperties>
<taskproperty id="tpd0" name="type" type="default" valuetype="icon"/>
<taskproperty id="tpd1" name="priority" type="default" valuetype="icon"/>
<taskproperty id="tpd2" name="info" type="default" valuetype="icon"/>
<taskproperty id="tpd3" name="name" type="default" valuetype="text"/>
<taskproperty id="tpd4" name="begindate" type="default" valuetype="date"/>
<taskproperty id="tpd5" name="enddate" type="default" valuetype="date"/>
<taskproperty id="tpd6" name="duration" type="default" valuetype="int"/>
<taskproperty id="tpd7" name="completion" type="default" valuetype="int"/>
<taskproperty id="tpd8" name="coordinator" type="default" valuetype="text"/>
<taskproperty id="tpd9" name="predecessorsr" type="default" valuetype="text"/>
</taskproperties>
<task id="0" name="Development Plan" color="#ffcc33" meeting="false" start="2018-09-25" duration="4" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="19" name="Team Meeting Plan" color="#8cb6ce" meeting="false" start="2018-09-25" duration="1" complete="100" thirdDate="2018-09-19" thirdDate-constraint="0" expand="true"/>
<task id="20" name="Team Communication Plan" color="#8cb6ce" meeting="false" start="2018-09-25" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="29" name="Copy_Team Communication Plan" color="#8cb6ce" meeting="false" start="2018-09-25" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="21" name="Team Member Roles" color="#8cb6ce" meeting="false" start="2018-09-26" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="22" name="Git workflow plan" color="#8cb6ce" meeting="false" start="2018-09-26" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="23" name="Proof of Concept" color="#8cb6ce" meeting="false" start="2018-09-27" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="24" name="Technology" color="#8cb6ce" meeting="false" start="2018-09-27" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="25" name="Coding Style" color="#8cb6ce" meeting="false" start="2018-09-28" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="26" name="Project Schedule" color="#8cb6ce" meeting="false" start="2018-09-28" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
<task id="27" name="Project review" color="#8cb6ce" meeting="false" start="2018-09-28" duration="1" complete="100" thirdDate="2018-09-13" thirdDate-constraint="0" expand="true"/>
</task>
<task id="8" name="Requirements Document Revision" color="#6666ff" meeting="false" start="2018-10-01" duration="5" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="31" name="Project Drivers" color="#8cb6ce" meeting="false" start="2018-10-01" duration="2" complete="100" thirdDate="2018-09-17" thirdDate-constraint="0" expand="true"/>
<task id="49" name="Functional Requirements" color="#8cb6ce" meeting="false" start="2018-10-02" duration="2" complete="100" thirdDate="2018-09-12" thirdDate-constraint="0" expand="true"/>
<task id="42" name="Non-Functional Requirements" color="#8cb6ce" meeting="false" start="2018-10-02" duration="2" complete="100" thirdDate="2018-09-12" thirdDate-constraint="0" expand="true"/>
<task id="44" name="Project Issues" color="#8cb6ce" meeting="false" start="2018-10-04" duration="1" complete="100" thirdDate="2018-09-12" thirdDate-constraint="0" expand="true">
<depend id="52" type="2" difference="0" hardness="Strong"/>
</task>
<task id="52" name="Push &amp; Tag Document" color="#8cb6ce" meeting="false" start="2018-10-05" duration="1" complete="100" thirdDate="2018-09-17" thirdDate-constraint="0" expand="true"/>
<task id="55" name="SpellCheck" color="#8cb6ce" meeting="false" start="2018-10-04" duration="1" complete="100" thirdDate="2018-09-18" thirdDate-constraint="0" expand="true">
<depend id="52" type="2" difference="0" hardness="Strong"/>
</task>
</task>
<task id="9" name="Proof of Concept Demonstration" color="#33ff33" meeting="false" start="2018-10-08" duration="4" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="59" name="Snake Body &amp; Movement" color="#8cb6ce" meeting="false" start="2018-10-08" duration="2" complete="100" thirdDate="2018-09-17" thirdDate-constraint="0" expand="true"/>
<task id="61" name="Home Page GUI" color="#8cb6ce" meeting="false" start="2018-10-09" duration="2" complete="100" thirdDate="2018-09-17" thirdDate-constraint="0" expand="true"/>
<task id="63" name="Border Boundaries" color="#8cb6ce" meeting="false" start="2018-10-11" duration="1" complete="100" thirdDate="2018-09-17" thirdDate-constraint="0" expand="true"/>
</task>
<task id="12" name="Test Plan Revision" color="#99ff66" meeting="false" start="2018-10-12" duration="11" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="64" name="General Information" color="#8cb6ce" meeting="false" start="2018-10-12" duration="1" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true"/>
<task id="65" name="Plan" color="#8cb6ce" meeting="false" start="2018-10-15" duration="1" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true"/>
<task id="66" name="System Test Description" color="#8cb6ce" meeting="false" start="2018-10-17" duration="2" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true"/>
<task id="67" name="Tests for Proof of Concept" color="#8cb6ce" meeting="false" start="2018-10-22" duration="3" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true">
<task id="82" name="Snake Module" color="#8cb6ce" meeting="false" start="2018-10-22" duration="1" complete="100" thirdDate="2018-10-15" thirdDate-constraint="0" expand="true">
<notes><![CDATA[- Test for appropriate reaction to snake movements based on keyboard presses.
- initialization of snake object
- Requirements involving the Snake module (see Test Plan requirements)]]></notes>
</task>
<task id="361" name="Interface Module" color="#8cb6ce" meeting="false" start="2018-10-22" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true">
<notes><![CDATA[- Test functionality within the user interface including mouse clicks towards edge of buttons and clicking window windows (exit, maximize, minimize)
]]></notes>
</task>
<task id="362" name="Food Module" color="#8cb6ce" meeting="false" start="2018-10-22" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="83" name="Non-functional requirements survey" color="#8cb6ce" meeting="false" start="2018-10-23" duration="2" complete="100" thirdDate="2018-10-15" thirdDate-constraint="0" expand="true">
<notes><![CDATA[- create a survey for peers to fill out upon playing a demo of the game. The
survey can be done in any means but it is recommended to use google
forms for ease of use.
- Add questions as you find apprioriate and show to family and peers
]]></notes>
</task>
</task>
<task id="68" name="Comparison to Existing Implementation" color="#8cb6ce" meeting="false" start="2018-10-25" duration="2" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true"/>
<task id="69" name="Unit Test Plan" color="#8cb6ce" meeting="false" start="2018-10-25" duration="2" complete="100" thirdDate="2018-10-08" thirdDate-constraint="0" expand="true"/>
</task>
<task id="13" name="Design &amp; Document Revision" color="#6600cc" meeting="false" start="2018-10-29" duration="7" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="85" name="Anticipated and Unlikely Changes" color="#8cb6ce" meeting="false" start="2018-10-29" duration="1" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true"/>
<task id="103" name="Introduction" color="#8cb6ce" meeting="false" start="2018-10-29" duration="1" complete="100" thirdDate="2018-10-31" thirdDate-constraint="0" expand="true"/>
<task id="86" name="Module Hierarchy" color="#8cb6ce" meeting="false" start="2018-10-30" duration="1" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true"/>
<task id="91" name="Conncection between Requirements and Design" color="#8cb6ce" meeting="false" start="2018-10-30" duration="1" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true"/>
<task id="93" name="Module Decomposition" color="#8cb6ce" meeting="false" start="2018-10-31" duration="2" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true" cost-manual-value="33.0" cost-calculated="false"/>
<task id="96" name="Traceability Matrix" color="#8cb6ce" meeting="false" start="2018-11-01" duration="1" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true"/>
<task id="98" name="Use Heirarchy between modules" color="#8cb6ce" meeting="false" start="2018-11-02" duration="1" complete="100" thirdDate="2018-10-18" thirdDate-constraint="0" expand="true"/>
<task id="99" name="MIS" meeting="false" start="2018-11-05" duration="2" complete="100" expand="true">
<task id="100" name="Interface | HIghscore | Theme - Doxygen" color="#8cb6ce" meeting="false" start="2018-11-05" duration="2" complete="100" thirdDate="2018-10-29" thirdDate-constraint="0" expand="true"/>
<task id="101" name="Food | init - Doxygen" color="#8cb6ce" meeting="false" start="2018-11-05" duration="2" complete="100" thirdDate="2018-10-29" thirdDate-constraint="0" expand="true"/>
<task id="102" name="Snake | Gameplay - doxygen" color="#8cb6ce" meeting="false" start="2018-11-05" duration="2" complete="100" thirdDate="2018-10-29" thirdDate-constraint="0" expand="true"/>
</task>
</task>
<task id="113" name="Module Implementation" color="#ff3333" meeting="false" start="2018-11-07" duration="6" complete="100" thirdDate="2018-11-07" thirdDate-constraint="0" expand="false">
<task id="114" name="highscore" color="#8cb6ce" meeting="false" start="2018-11-07" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="117" name="Gameplay" color="#8cb6ce" meeting="false" start="2018-11-07" duration="2" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="119" name="init" color="#8cb6ce" meeting="false" start="2018-11-09" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="121" name="Interface" color="#8cb6ce" meeting="false" start="2018-11-07" duration="2" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="123" name="Food" color="#8cb6ce" meeting="false" start="2018-11-09" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="125" name="Themes" color="#8cb6ce" meeting="false" start="2018-11-13" duration="2" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="363" name="Snake" color="#8cb6ce" meeting="false" start="2018-11-12" duration="1" complete="100" thirdDate="2018-11-13" thirdDate-constraint="0" expand="true"/>
<task id="364" name="Food" color="#8cb6ce" meeting="false" start="2018-11-12" duration="1" complete="100" thirdDate="2018-11-13" thirdDate-constraint="0" expand="true"/>
</task>
<task id="309" name="Testing" meeting="false" start="2018-11-15" duration="3" complete="100" expand="false">
<task id="310" name="System/Integration testing" color="#8cb6ce" meeting="false" start="2018-11-15" duration="1" complete="100" thirdDate="2018-10-12" thirdDate-constraint="0" expand="true">
<notes><![CDATA[Will be done throughout the development process to check if everything works together correctly. Closer to the final date, peers will be asked to try the game as part of system testing.]]></notes>
</task>
<task id="355" name="Gameplay - unit testing" color="#8cb6ce" meeting="false" start="2018-11-16" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="357" name="Interface - manual/integrated testing" color="#8cb6ce" meeting="false" start="2018-11-19" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
<task id="359" name="Themes - integrated testing" color="#8cb6ce" meeting="false" start="2018-11-16" duration="1" complete="100" thirdDate="2018-10-22" thirdDate-constraint="0" expand="true"/>
</task>
<task id="14" name="Revision 0 Demonstration" color="#66ffff" meeting="false" start="2018-11-20" duration="1" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="495" name="Meeting to run through Rev 0 Demo" color="#8cb6ce" meeting="false" start="2018-11-20" duration="1" complete="100" thirdDate="2018-11-16" thirdDate-constraint="0" expand="true"/>
</task>
<task id="15" name="Final Demonstration" color="#ff9933" meeting="false" start="2018-11-21" duration="5" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="false">
<task id="541" name="Presentation Slides - Draft 1" color="#8cb6ce" meeting="false" start="2018-11-22" duration="1" complete="100" thirdDate="2018-11-20" thirdDate-constraint="0" expand="true"/>
<task id="542" name="Presentation practice" color="#8cb6ce" meeting="false" start="2018-11-23" duration="1" complete="100" thirdDate="2018-11-21" thirdDate-constraint="0" expand="true"/>
<task id="543" name="Edit slides" color="#8cb6ce" meeting="false" start="2018-11-23" duration="2" complete="100" thirdDate="2018-11-22" thirdDate-constraint="0" expand="true"/>
<task id="544" name="Improve Game Interface" color="#8cb6ce" meeting="false" start="2018-11-21" duration="1" complete="100" thirdDate="2018-11-19" thirdDate-constraint="0" expand="true">
<notes><![CDATA[Some elements to imporve:
- color contrast
- color schemes and layout
- font
]]></notes>
</task>
<task id="17" name="Peer Evaluation - Final Demo" color="#8cb6ce" meeting="false" start="2018-11-27" duration="1" complete="100" thirdDate="2018-09-27" thirdDate-constraint="0" expand="true"/>
</task>
<task id="18" name="Final Documentation" color="#cc0000" shape="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" meeting="false" start="2018-11-28" duration="4" complete="58" thirdDate="2018-09-27" thirdDate-constraint="0" expand="true">
<notes><![CDATA[Problem Statement
Development Plan
Requirements Document
Design Document
Test Plan
Test Report
Users Guide (optional)
Source Code]]></notes>
<task id="694" name="Feedback Revision" color="#8cb6ce" meeting="false" start="2018-11-28" duration="1" complete="100" thirdDate="2018-10-19" thirdDate-constraint="0" expand="true">
<notes><![CDATA[Each member will apply the feedback given in each document for their specific part. In order to ensure completeness, the team will meet and go through each point of feedback to make sure it has been fixed by one of the three members.
]]></notes>
</task>
<task id="696" name="Clean Code" color="#8cb6ce" meeting="false" start="2018-11-29" duration="1" complete="100" thirdDate="2018-11-27" thirdDate-constraint="0" expand="true">
<notes><![CDATA[- any repeated constant declarations, unnecessary comments and sections that
have been commented out for testing
- folder organization of images and other files
]]></notes>
</task>
<task id="697" name="Test Report" color="#8cb6ce" meeting="false" start="2018-11-30" duration="2" complete="16" thirdDate="2018-11-28" thirdDate-constraint="0" expand="true">
<task id="993" name="Section 4,5 and 8" color="#8cb6ce" meeting="false" start="2018-11-30" duration="2" complete="50" thirdDate="2018-11-30" thirdDate-constraint="0" expand="true"/>
<task id="1037" name="Section 2,3 and 9" color="#8cb6ce" meeting="false" start="2018-11-30" duration="2" complete="0" thirdDate="2018-11-30" thirdDate-constraint="0" expand="true" cost-manual-value="0.0" cost-calculated="true"/>
<task id="1039" name="Section 1,6 and 7" color="#8cb6ce" meeting="false" start="2018-11-30" duration="2" complete="0" thirdDate="2018-11-30" thirdDate-constraint="0" expand="true" cost-manual-value="0.0" cost-calculated="true"/>
</task>
</task>
</tasks>
<resources>
<resource id="3" name="Andy" function="4" contacts="hameea1@mcmaster.ca" phone="6479276093"/>
<resource id="4" name="Usman" function="4" contacts="irfanm7@mcmaster.ca" phone="4168787844">
<rate name="standard" value="99"/>
</resource>
<resource id="5" name="Vaibhav" function="8" contacts="chadhav@mcmaster.ca" phone="6474545182">
<rate name="standard" value="100"/>
</resource>
<resource id="6" name="Varun Hooda" function="2" contacts="hoodav@mcmaster.ca" phone=""/>
<resource id="7" name="Dr. Bokhari" function="3" contacts="bokhari@mcmaster.ca" phone=""/>
</resources>
<allocations>
<allocation task-id="44" resource-id="3" function="1" responsible="true" load="50.0"/>
<allocation task-id="55" resource-id="3" function="1" responsible="true" load="50.0"/>
<allocation task-id="59" resource-id="3" function="1" responsible="true" load="100.0"/>
<allocation task-id="66" resource-id="3" function="1" responsible="true" load="20.0"/>
<allocation task-id="93" resource-id="3" function="1" responsible="true" load="33.0"/>
<allocation task-id="102" resource-id="3" function="1" responsible="true" load="100.0"/>
<allocation task-id="98" resource-id="3" function="1" responsible="true" load="100.0"/>
<allocation task-id="103" resource-id="3" function="1" responsible="true" load="100.0"/>
<allocation task-id="117" resource-id="3" function="1" responsible="true" load="50.0"/>
<allocation task-id="119" resource-id="3" function="1" responsible="true" load="100.0"/>
<allocation task-id="355" resource-id="3" function="1" responsible="false" load="50.0"/>
<allocation task-id="359" resource-id="3" function="1" responsible="true" load="20.0"/>
<allocation task-id="31" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="64" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="68" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="19" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="21" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="23" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="27" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="82" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="83" resource-id="3" function="4" responsible="true" load="60.0"/>
<allocation task-id="86" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="121" resource-id="3" function="4" responsible="false" load="50.0"/>
<allocation task-id="363" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="125" resource-id="3" function="4" responsible="false" load="40.0"/>
<allocation task-id="495" resource-id="3" function="4" responsible="true" load="33.0"/>
<allocation task-id="544" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="541" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="542" resource-id="3" function="4" responsible="false" load="20.0"/>
<allocation task-id="17" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="694" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="696" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="357" resource-id="3" function="4" responsible="false" load="60.0"/>
<allocation task-id="993" resource-id="3" function="4" responsible="true" load="100.0"/>
<allocation task-id="49" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="65" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="66" resource-id="4" function="4" responsible="false" load="40.0"/>
<allocation task-id="101" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="91" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="93" resource-id="4" function="4" responsible="false" load="33.0"/>
<allocation task-id="96" resource-id="4" function="4" responsible="false" load="67.0"/>
<allocation task-id="117" resource-id="4" function="4" responsible="false" load="50.0"/>
<allocation task-id="123" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="355" resource-id="4" function="4" responsible="true" load="50.0"/>
<allocation task-id="359" resource-id="4" function="4" responsible="false" load="20.0"/>
<allocation task-id="63" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="20" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="24" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="26" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="362" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="83" resource-id="4" function="4" responsible="false" load="20.0"/>
<allocation task-id="364" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="495" resource-id="4" function="4" responsible="false" load="33.0"/>
<allocation task-id="543" resource-id="4" function="4" responsible="true" load="50.0"/>
<allocation task-id="17" resource-id="4" function="4" responsible="false" load="100.0"/>
<allocation task-id="694" resource-id="4" function="4" responsible="false" load="100.0"/>
<allocation task-id="1039" resource-id="4" function="4" responsible="true" load="100.0"/>
<allocation task-id="42" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="52" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="61" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="69" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="66" resource-id="5" function="8" responsible="false" load="40.0"/>
<allocation task-id="100" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="85" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="93" resource-id="5" function="8" responsible="false" load="34.0"/>
<allocation task-id="114" resource-id="5" function="8" responsible="true" load="50.0"/>
<allocation task-id="121" resource-id="5" function="8" responsible="true" load="50.0"/>
<allocation task-id="125" resource-id="5" function="8" responsible="true" load="60.0"/>
<allocation task-id="357" resource-id="5" function="8" responsible="true" load="40.0"/>
<allocation task-id="359" resource-id="5" function="8" responsible="false" load="60.0"/>
<allocation task-id="29" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="22" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="25" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="361" resource-id="5" function="8" responsible="true" load="100.0"/>
<allocation task-id="83" resource-id="5" function="8" responsible="false" load="20.0"/>
<allocation task-id="495" resource-id="5" function="8" responsible="false" load="34.0"/>
<allocation task-id="542" resource-id="5" function="8" responsible="false" load="40.0"/>
<allocation task-id="543" resource-id="5" function="8" responsible="false" load="50.0"/>
<allocation task-id="17" resource-id="5" function="8" responsible="false" load="100.0"/>
<allocation task-id="694" resource-id="5" function="8" responsible="false" load="100.0"/>
<allocation task-id="1037" resource-id="5" function="8" responsible="false" load="100.0"/>
</allocations>
<vacations/>
<previous/>
<roles roleset-name="Default"/>
<roles>
<role id="1" name="UI Deisgner | Project Schedule Administrator"/>
<role id="2" name="TA"/>
<role id="3" name="Course Professor"/>
<role id="4" name="Main Programmer | Requirements Documentation"/>
<role id="5" name="Tester"/>
<role id="6" name="Requirements &amp; Documentation Editor"/>
<role id="7" name="Project Schedule Editor"/>
<role id="8" name="Git master | Testing Requirements"/>
</roles>
</project>
File added
# Project Name
# Snake 2.o
Team Name: ?
Team Name: VUA30
Team Members: ?, ?, ?
Team Members: Usman Irfan, Andy Hameed, Vaihbav Chadha
This project is a reimplementation of ...
This project is a reimplementation of Snake, an open-source front-end implementation of the classical snake game using JS, HTML and CSS
The folders and files for this project are as follows:
Doc - Documentation for the project
Code - Implementation
Doc_Revision1 - Latest Documentation for the project
POC-Demo - Demo for Proof of Concept
ProjectSchedule - gantt chart as pdf and .gan file
src - Implementation
# Project Name
# Snake 2.o
This folder holds information and resources of interest for the project. This
is intended to be a convenient location for project members to access
......
## @file Food.py
# @author Usman Irfan
# @brief implements an abstract data type for a snake's food
# @date 11/09/2018
from random import randint
from init import *
## @brief An Abstract Data type which represents a one-unit of food
class Food():
## @brief Food constructor
# @details Initializes the size of the food, this needs to be the same as
# snake's block size
# @param blockSize the width and height of the square block representing the food
def __init__(self, blockSize):
self.size = blockSize
## @brief Draw method uses pygame to draw the food object on the window
# @param location A list which consists the x and y location of the food
def draw_food(self, food_colour, location):
maze_x = (location[0] == 100)
maze_y = location[1] >= 100 and location[1] <= 320
maze2_x = (location[0] == 380)
if ((maze_x and maze_y) or (maze2_x and maze_y)):
location[0] = randint(0, grid_length - 1) * self.size
location[1] = randint(0, grid_length - 1) * self.size
pygame.draw.rect(win, food_colour , (location[0],location[1], self.size, self.size))
## @brief redraw_food method redraws the food on the screen randomly
# @param x is the location of snake's x-axis head location
# @param y is the location of snake's y-axis head location
# @param location is a list that gives the location of present food
# @param screenSize is the size of the screen
def redraw_food(self, x, y, location,screenSize, snake_loc):
maze_x = (x == 100)
maze_y = y >= 100 and y <= 320
maze2_x = (x == 380)
if(abs(x - location[0]) < 15 and abs(y - location[1]) < 15):
location[0] = randint(0, grid_length - 1) * self.size
location[1] = randint(0, grid_length - 1) * self.size
if((location in snake_loc) or (maze_x and maze_y) or (maze2_x and maze_y)):
location[0] = randint(0, grid_length - 1) * self.size
location[1] = randint(0, grid_length - 1) * self.size
## @file GUI.py
# @Author Vaibhav Chadha | Andy Hameed
# @brief A library for common functions used for displaying text and buttons
# @details Used in modules that display text and buttons
# @date 11/09/2018
import pygame, sys
## @brief A method to create a button
# @details This method will make a box on the interface
# @param surface The background (surface) the box should be made on
# @param color The color of the button to be made
# @param Rect The coordinate of the button with the length and width
# @param width The width of the sides of button
def button(Surface, color,Rect,width):
pygame.draw.rect(Surface, color,Rect,width)
## @brief A method to display text
# @details This function will print the text on the interface
# @param text The text to be printed
# @param fontStyle The font Style of the text to be displayed
# @param fontSize The size of the text written
# @param color The color of the text
# @param coord The coordinate at which the text should start displaying
# @param surface The background (surface) the text should be printed on
def text(text,fontStyle,fontSize,color,coord,surface):
font = pygame.font.SysFont(fontStyle,fontSize)
text = font.render(text,True,color)
surface.blit(text,coord)
## @brief A method to display downloaded text using .ttf files
# @details This function will print the text on the interface
# @param text The text to be printed
# @param fontName The name of the font/ttf file
# @param fontSize The size of the text written
# @param color The color of the text
# @param coord The coordinate at which the text should start displaying
# @param surface The background (surface) the text should be printed on
def custom_text(text,fontName,fontSize,color,coord,surface):
font = pygame.font.Font(fontName,fontSize)
text = font.render(text,True,color)
surface.blit(text,coord)
## @file Gameplay.py
# @author Andy Hameed | Usman Irfan
# @brief implements gameplay and connects the different components of the game
# @details including the snake, food item, score, exit and main interface
# @date 11/09/2018
from random import randint
from Snake import *
from Food import *
from colors import *
import ScoreDisplay
import GUI
def game(speed, colour,food_colour, backgroundColour):
pygame.event.clear()
image = pygame.image.load("Images/barrier.png")
x = randint(0, grid_length) * size
y = randint(0, grid_length) * size
#defining a list to update snanke's length
snake_loc = []
#variable to increment snake's length, initially it would be 1
snake_length = 1
# 0 gives (- direction)
# 1 gives (+ direction)
direction = 1
# 0 - x-axis , 1 - y-axis
axis = 0
score = 0
# parameters for initializing food on the screen
food_location = []
food_x = randint(0, grid_length - 1) * size
food_y = randint(0, grid_length - 1) * size
food_location = [food_x, food_y]
##initialize snake and draw snake body somewhere on the screen
snake = Snake(size, 0, 20, 1)
pygame.draw.rect(win, colour , [x,y, size, size])
food = Food(size)
still = True
#Loop through the events as long as the game is running
run = True
while run:
#delay controls part of speed
pygame.time.delay(speed)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
#Each event type has an integer assigned to it. KEYDOWN has the code 2
if event.type == pygame.KEYDOWN:
if (event.key == pygame.K_LEFT):
# if snake is moving up or down, turn left, otherwise don't turn
if (snake.axis or still): snake.direct = -1; still = False
snake.axis = 0
if (event.key == pygame.K_RIGHT):
#if snake is moving up or down turn right, otherwise dont turn
if (snake.axis or still): snake.direct = 1; still = False
snake.axis = 0
if (event.key == pygame.K_UP):
#if snake is moving left or right turn up, otherwise dont turn
if (not snake.axis or still): snake.direct = -1; still = False
snake.axis = 1
if (event.key == pygame.K_DOWN):
#if snake is moving left or right turn down, otherwise dont turn
if (not snake.axis or still): snake.direct = 1; still = False
snake.axis = 1
#Snake moving depending on axis and direction
if (snake.axis):
y += (size)*snake.direct
else:
x += (size)*snake.direct
boundary_condition = (x < 0 or y < 0 or y > screenSize - size or x > screenSize - size)
maze_x = x == 100
maze_y = abs(y - 210) <= 110
maze2_x = x == 380
if (speed == 100):
if x < 0:
#x = 0
x = screenSize - size
if y < 0:
#y = 0
y = screenSize - size
if y > screenSize - size:
#y = 500 - size
y = 0
if x > screenSize - size:
#x = 500 - size
x = 0
elif (speed == 70):
#Boundary conditions for snake hitting window edge
if (boundary_condition):
run = False
ScoreDisplay.display(score,speed, colour,food_colour, backgroundColour)
elif (speed == 71):
if ((maze_x and maze_y) or boundary_condition or (maze2_x and maze_y)):
run = False
ScoreDisplay.display(score,speed, colour,food_colour, backgroundColour)
#detect collision between food and snake head
if(abs(x - food_location[0]) < 15 and abs(y - food_location[1]) < 15):
if (speed == 100):
score += 5
elif (speed == 70):
score += 7
else:
score += 10
#increment the length by 3 unit every time
snake_length += 3
win.fill(backgroundColour)
if speed == 71:
win.blit(image,(100,100))
win.blit(image,(380,100))
#Display Score
sc_color = black if backgroundColour[0] == 255 else white
GUI.custom_text(" " + str(score),"Roboto-Light.ttf",30,sc_color,(0,0),win)
if ([x,y] in snake_loc) and snake_length > 1:
ScoreDisplay.display(score,speed, colour,food_colour, backgroundColour)
snake_head = []
snake_head.append(x)
snake_head.append(y)
snake_loc.append(snake_head)
#function to print
#consumption of food block
food.redraw_food(x, y, food_location, screenSize, snake_loc)
snake_blocks = len(snake_loc)
#Draw food item
food.draw_food(food_colour, food_location)
if snake_blocks > snake_length:
#keep updating the new block
del snake_loc[0]
'''
Logic for updating the length is taken from:
CodeWithHarry, CodeWithHarry. “Snakes Game: Length Increment Logic - Python Game Development Using Pygame In Hindi #17.”
YouTube, YouTube, 2 Oct. 2018,
www.youtube.com/watch?v=mkGJb0W03DM&index=17&list=PLu0W_9lII9ailUQcxEPZrWgDoL36BtPYb.
'''
#Draw snake
snake.draw(colour,snake_loc)
#update display
pygame.display.update()
pygame.quit()
BlankProjectTemplate/src/Images/Exit_image.png

10 KiB

BlankProjectTemplate/src/Images/Exit_image_empty.png

1.45 KiB