rock_paper_scissors
所属分类:浏览器
开发工具:HTML
文件大小:0KB
下载次数:0
上传日期:2021-10-09 17:27:03
上 传 者:
sh-1993
说明: 一个简单的烧瓶应用程序,允许在网络浏览器中玩石头、纸、剪刀游戏,包括两人游戏和玩...
(A simple flask app to allow to play a game of rock, paper, scissors in a web browser including a two-player and player vs computer mode.)
文件列表:
.flaskenv (38, 2021-10-09)
__pycache__/ (0, 2021-10-09)
__pycache__/app.cpython-39.pyc (312, 2021-10-09)
app.py (134, 2021-10-09)
controllers/ (0, 2021-10-09)
controllers/__pycache__/ (0, 2021-10-09)
controllers/__pycache__/controller.cpython-39.pyc (2156, 2021-10-09)
controllers/controller.py (2055, 2021-10-09)
models/ (0, 2021-10-09)
models/__pycache__/ (0, 2021-10-09)
models/__pycache__/game.cpython-39.pyc (853, 2021-10-09)
models/__pycache__/player.cpython-39.pyc (466, 2021-10-09)
models/__pycache__/players.cpython-39.pyc (312, 2021-10-09)
models/game.py (861, 2021-10-09)
models/player.py (108, 2021-10-09)
static/ (0, 2021-10-09)
static/Kitsune-ken.jpeg (250111, 2021-10-09)
static/Paper.jpg (73839, 2021-10-09)
static/Rock.jpg (60681, 2021-10-09)
static/Scissors.jpg (81132, 2021-10-09)
static/Screenshot 2021-10-01 at 05.51.33.png (893742, 2021-10-09)
static/Screenshot 2021-10-08 at 09.52.03.png (914298, 2021-10-09)
static/Screenshot 2021-10-08 at 09.55.50.png (671313, 2021-10-09)
static/Seal_of_China.svg (74789, 2021-10-09)
static/style.css (2881, 2021-10-09)
templates/ (0, 2021-10-09)
templates/base.html (636, 2021-10-09)
templates/computer.html (760, 2021-10-09)
templates/index.html (446, 2021-10-09)
templates/player_2.html (502, 2021-10-09)
templates/result.html (512, 2021-10-09)
templates/result_computer.html (543, 2021-10-09)
templates/welcome.html (2586, 2021-10-09)
# Rock / Paper / Scissors
Create a simple flask app to allow the user to play rock, paper, scissors in their browser. This was built during the week 3 of the CodeClan Software Developer.
![](https://github.com/ByAnthony/rock_paper_scissors/blob/main/static/Screenshot%202021-10-01%20at%2005.51.33.png?raw=true)
## Contents
* [Brief](#brief)
* [Technologies](#technologies)
* [Setup](#setup)
## Brief
- You should be able to go to /rock/scissors and return the string "Player 1 wins by playing rock" to the page, for example;
- Write a class to represent the player. The player will have a name and their choice (rock/paper/scissors);
- Write a game class that has a function that takes in the 2 players and compares their choices and returns the winning player. If it is a draw the player should be None type;
- Change your route to use a template to display the users choices and the result.
### Extensions:
- Add a welcome page (and a route to get it) to explain the rules before the user picks their move. Add a link to this in the base template;
- Add some CSS to either/both of your pages.
![](https://github.com/ByAnthony/rock_paper_scissors/blob/main/static/Screenshot%202021-10-08%20at%2009.52.03.png?raw=true)
### Further extension:
- Extend the game with a new page to allow the user to play against the computer;
- If they go to /play it will take the user to a form to allow them to enter their name and choose a move from a dropdown;
- Add a link to this page to the base template;
- Write a new method in the game class to generate a computer player with the name "Computer" and a random choice from rock, paper and scissors;
- Use the same game logic and results template to display the winner.
![](https://github.com/ByAnthony/rock_paper_scissors/blob/main/static/Screenshot%202021-10-08%20at%2009.55.50.png?raw=true)
## Technologies
The project was created with:
- Python 3;
- psycog2;
- HTML/CSS;
- Flask.
## Setup
Pre-requisites and usage:
- Install Python3 and pip3;
- Install Flask:
```
pip3 install flask
```
- Install psycopg2:
```
pip3 install psycopg2
```
- Clone/download the project and navigate to that directory in your terminal client;
- Start Flask:
```
flask run
```
- Navigate to the site in your browser at http://localhost:5000/rock-paper-scissors/
近期下载者:
相关文件:
收藏者: