Code Monkey home page Code Monkey logo

advanced-rps's Introduction

Rock Paper Scissors 7

Advanced version of Paper Rock Scissors , 2016-03-10

By Joe Karasek, Michael Lor, Aundra Miller, Nic Netzel

Description

Rock Paper Scissors 7 is an PHP/Silex based web-app game developed by a team of 4 developers over the course of one week. This application allows users to play a version of Rock, Paper, Scissors that has 7 instead of 3 choices: 'Air', 'Water', 'Fire', and 'Sponge' are added to the classic mix of 'Rock', 'Paper', and 'Scissors'. Game modes include Freeplay, Best of 1, Best of 3, Best of 5, Best of 7, and Best of 73. Users can create an account, sign-in, and sign-out. Game statistics are stored and players can see their stats, compare their stats to the computer, and view a leaderboard of all players' results.

This application was completed as a capstone of the level 2 PHP course at Epicodus. To build this web-app, we applied our newly gained knowledge of PHP, the Silex framework, phpUnit, and mySQL. We also used a range of css frameworks and the Google Charts API.

To see our latest work, please checkout our personal portfolios...

Setup/Installation

Requirements

Setup

  1. The dependencies for this project are managed using Composer. In terminal run the following command to install project dependencies: composer install

  2. You will need to run a local server to host the site, including your DB server. From the project root, run the following terminal commands:

     cd web
     mysql.server start
     php -S localhost:8000
    
  3. Open the directory http://localhost:8000 in any standard web browser.

SQL Database

A SQL database is included with the repo as a zip file. However, you can use the following mySQL commands to setup your own version of the database:

CREATE DATABASE rps;
USE rps;
CREATE TABLE rounds (id serial PRIMARY KEY, player_one_id INT, player_one_choice VARCHAR(255), player_two_id INT, player_two_choice VARCHAR(255), winner_id INT, match_id INT);
CREATE TABLE players (id serial PRIMARY KEY, name VARCHAR(255), password VARCHAR(255));
CREATE TABLE matches (id serial PRIMARY KEY, player_one_id INT, player_one_score VARCHAR(255), player_two_id INT, player_two_score VARCHAR(255), winner_id INT);
  • To run phpUnit, you will need to create a test database called 'rps_test' with the same structure as the 'rps' database.
  • The 'players' table in the database will need an entry for 'computer' with an id of 0 for the program to function correctly. This is included in the repo database, but if you make your own database you will need to add this entry before the program works.

phpUnit

PHPUnit is included with the dependencies for this project. To run phpunit, use the following commands in terminal (from the project root directory):

export PATH=$PATH:./vendor/bin
phpunit tests

Known Bugs

  • An entry for the 'computer' must be added to the database column players with an id equal to 0. This should be validated by the application.
  • Multi-player Mode is not currently Supported
  • Match Mode statistics treat an unfinished/early exited game as a loss for the player
  • Entries into database (player name, player password), are not sanitized for characters that break SQL such as apostrophes.

Technologies Used

License

Copyright (c) 2016 Joe Karasek, Michael Lor, Aundra Miller, Nic Netzel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Graphics Copyright (c) 2016 Michael Lor

Original Idea for RPS-7 (c) 2003 David C. Lovelace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.