diff --git a/flask/testapp/static/javascript/beautyVote.js b/flask/testapp/static/javascript/beautyVote.js
index 4c17af2..eb7cf1b 100644
--- a/flask/testapp/static/javascript/beautyVote.js
+++ b/flask/testapp/static/javascript/beautyVote.js
@@ -42,8 +42,9 @@
canvasSize(960, 1200);
lineW(3);
timer = 0;
- scene = START_SCENE;
setQuestion(round);
+ player.name = username;
+ player.number = userNumber;
}
@@ -288,7 +289,6 @@
var splitplayer = max_current_player.split(" ");
max_player = splitplayer[0]
current_player = splitplayer[1]
- console.log(max_player);
}
}
}
diff --git a/flask/testapp/static/javascript/resultScreen.js b/flask/testapp/static/javascript/resultScreen.js
index 0848308..4ab91e8 100644
--- a/flask/testapp/static/javascript/resultScreen.js
+++ b/flask/testapp/static/javascript/resultScreen.js
@@ -60,7 +60,6 @@
fText("美人投票ゲーム", 480, 100, 80, "white");
setAlp(50);
- fText("あなたの名前を入力してください", 480, 200, 50, "black");
setAlp(20);
fRect(100, 800, 760, 300, "black");
@@ -97,9 +96,6 @@
fRect(50, 50, 855, 100, "black");
fText("美人投票ゲーム", 480, 100, 80, "white");
- setAlp(50);
- fText("あなたの名前を入力してください", 480, 200, 50, "black");
-
setAlp(100);
fText("参加予定者:" + max_player + "人", 480, 300, 50, "black");
fText("現在の参加者:" + current_player + "人", 480, 400, 50, "black");
@@ -113,7 +109,6 @@
tapC ++;
if(200 <= tapX && tapX <= 760 && 580 <= tapY && tapY <= 780){
sendStart();
- console.log("GAMESTART");
}
}
}
diff --git a/flask/testapp/templates/testapp/index.html b/flask/testapp/templates/testapp/index.html
index 5399aad..80f26d2 100644
--- a/flask/testapp/templates/testapp/index.html
+++ b/flask/testapp/templates/testapp/index.html
@@ -39,8 +39,6 @@
-
-
@@ -52,6 +50,11 @@
+
diff --git a/flask/testapp/templates/testapp/inputName.html b/flask/testapp/templates/testapp/inputName.html
index b00937d..920830f 100644
--- a/flask/testapp/templates/testapp/inputName.html
+++ b/flask/testapp/templates/testapp/inputName.html
@@ -16,7 +16,7 @@
display: inline-block;
width: 50%;
line-height: 3;
- border: 1px solid #999;
+ border: 3px solid #999;
box-sizing: border-box;
background: #f2f2f2;
margin: 0.5em 0;
@@ -34,11 +34,12 @@
width:fit-content + 50px;
align-self: center;
margin: auto;
- margin-top: 50px;
+ margin-top: 20px;
}
#introduction{
- background-color: aquamarine;
+ background-color: rgb(77, 31, 175);
+ color: aliceblue;
}
#title{
@@ -48,12 +49,15 @@
}
#startButton{
- background: #999;
- width:50%;
- height: 200%;
- margin: 0.8em 0;
- font-size: larger;
+ background: hsl(0, 0%, 0%);
+ color: white;
+ margin: 0.5em 0;
+ font-size: 20px;
box-sizing: border-box;
+ padding: 10px 20px;
+ width:50%;
+ border-radius: 4px; /* ボタンの角丸 */
+ cursor: pointer; /* ポインターをボタンに合わせた時のカーソルスタイル */
}
.right{
@@ -68,8 +72,11 @@
@@ -84,24 +91,12 @@
美人投票とは?
-
有名な経済学者のケインズは、玄人筋の行う投資は投票者が100枚の写真の中から最も容貌の美しい6枚を選び、
-
その選択が投票者全体の平均的な好みに最も近かった者に賞品が与えられるという新聞投票に見立てることができるとした。
+
有名な経済学者のケインズは、玄人筋の行う投資は投票者が100枚の写真の中から最も容貌の美しい6枚を選び、
+ その選択が投票者全体の平均的な好みに最も近かった者に賞品が与えられるという新聞投票に見立てることができるとした。
各投票者は、自身が最も美しいと思う写真を選ぶのではなく、他の投票者の好みに最もよく合うと思う写真を選択しなければならないことを意味する。
株式投資に関しても、市場参加者(=投票者)の多くが、値上がりするであろう(=容貌が美しいであろう)と判断する銘柄(=写真)を選ぶことが有効な投資方法であるということ。
出典:証券用語解説集(野村證券)
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/flask/testapp/views.py b/flask/testapp/views.py
index d5cb00e..3995097 100644
--- a/flask/testapp/views.py
+++ b/flask/testapp/views.py
@@ -40,6 +40,34 @@
start, end = 0, 0
+@app.route("/", methods=["GET", "POST"])
+def inputName():
+ global user_number, current_player, start_flag, user
+
+ if request.method == "GET":
+ return render_template("testapp/inputName.html")
+ if request.method == "POST":
+ # ゲーム開始時にユーザー数を出しておき,それぞれに識別番号を振る
+ if request.form.get("username"):
+ # ユーザー名を取得し,ユーザー情報を登録
+ username = request.form.get("username")
+ if user_number >= MAX_PLAYER or start_flag:
+ return render_template("testapp/index.html", scene=9)
+
+ user[user_number] = username
+ user_number += 1
+ current_player = user_number
+ print("Received name:", username, "現在の参加人数:", user_number)
+
+ return render_template(
+ "testapp/index.html",
+ username=username,
+ user_number=user_number - 1,
+ scene=6,
+ )
+
+
+
@app.route("/form", methods=["GET", "POST"])
def index():
global frequent_table, user_number, data_count, order_table, most_common_option, max_order, current_player, start, end, start_flag
@@ -48,21 +76,6 @@
return render_template("testapp/index.html")
if request.method == "POST":
- # ゲーム開始時にユーザー数を出しておき,それぞれに識別番号を振る
- if request.form.get("username"):
- # ユーザー名を取得し,ユーザー情報を登録
- username = request.form.get("username")
- if user_number >= MAX_PLAYER or start_flag:
- return "Capasity ERROR"
-
- user[user_number] = username
- print("Received name:", username, "UserNumber:", user_number)
-
- user_number += 1
- current_player = user_number
- print(f"現在の参加人数: {current_player}")
- # クライアントサイドに識別番号を返す
- return str(user_number - 1)
# 他のplayerが揃うのを待機(nemoto追記)
if request.form.get("checkStart"):
@@ -141,19 +154,21 @@
counter = Counter(get_data)
get_frequent_table = ""
# 選択肢の人数が多い順にリストを取得(選択肢、人数)
- common_order = (
- counter.most_common()
- )
+ common_order = counter.most_common()
# 文字列として保存
for i in range(5):
- get_frequent_table += str(common_order[i][0]) if len(common_order) > i else str(4)
+ get_frequent_table += (
+ str(common_order[i][0]) if len(common_order) > i else str(4)
+ )
get_frequent_table += " "
- get_frequent_table += str(common_order[i][1]) if len(common_order)> i else str(0)
+ get_frequent_table += (
+ str(common_order[i][1]) if len(common_order) > i else str(0)
+ )
get_frequent_table += "\n"
-
+
if get_frequent_table.endswith("\n"):
get_frequent_table = get_frequent_table[:-1] # 最後の改行文字を削除
-
+
return get_frequent_table