-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (31 loc) · 1.11 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from flask import *
app = Flask(__name__)
from Game import *
# Starting route
@app.route('/', methods=['post', 'get'])
def index():
if request.method == 'POST':
value = request.form['button']
msg = request.form['choice']
row, col = mapper(int(value))
if msg == 'red':
msg = red_play(row, col)
elif msg == 'red_start':
msg = red_play_first(row, col)
else:
msg = green_play(row, col)
Star_Converter()
return render_template('index.html', Display_Box=Display_Box, board_Player=board_Player, msg=msg)
else:
return render_template('index.html', Display_Box=Display_Box, board_Player=board_Player, msg='red_start')
# reset rote
@app.route('/reset', methods=['post', 'get'])
def reset():
for i in range(5):
for j in range(5):
board_Count[i][j] = 0
board_Player[i][j] = '0'
Display_Box[i][j] = '0'
return render_template('index.html', Display_Box=Display_Box, board_Player=board_Player, msg='red_start')
if __name__ == '__main__':
app.run(debug=True, port=3456)