diff --git a/flask/testapp/static/image/Keynes.jpg b/flask/testapp/static/image/Keynes.jpg new file mode 100644 index 0000000..d1103e3 --- /dev/null +++ b/flask/testapp/static/image/Keynes.jpg Binary files differ diff --git a/flask/testapp/static/javascript/beautyVote.js b/flask/testapp/static/javascript/beautyVote.js index eb7cf1b..150369c 100644 --- a/flask/testapp/static/javascript/beautyVote.js +++ b/flask/testapp/static/javascript/beautyVote.js @@ -45,6 +45,7 @@ setQuestion(round); player.name = username; player.number = userNumber; + console.log(language); } @@ -180,7 +181,7 @@ function setQuestion(round){ - question[round].join(questions[round], realAnswer[round],choices[round][A], choices[round][B], choices[round][C], choices[round][D]); + question[round].join(questions[language*MAX_ROUND+round], realAnswer[round],choices[language*MAX_ROUND+round][A], choices[language*MAX_ROUND+round][B], choices[language*MAX_ROUND+round][C], choices[language*MAX_ROUND+round][D]); } @@ -352,7 +353,7 @@ var round = 0; //変更 -var MAX_ROUND = 3; +var MAX_ROUND = 10; var CHOICE_NUMBER = 5; var max_player = 0; // 最大のplayer数(変更不要) var current_player = 0; @@ -366,7 +367,6 @@ var D = 3; var E = 4; - var CORRECT = 1; var WRONG = 0; @@ -380,10 +380,15 @@ var ROUND_RESULT = 8; var CAPASITY_ERROR = 9; +var JPN = 0; +var ENG = 1; + var scene = 0; var orderTable = ""; +var language = 0; + var question = new Array(MAX_ROUND); for(var i = 0; i < MAX_ROUND+1; i ++){ question[i] = new Question(); @@ -401,12 +406,17 @@ "カスタネットの名前の由来となったものは?", "名前が人物に由来しているのは?", "ジンベイザメは英語で何シャーク?", - "心臓がない生き物は?"]; -/* -var answers = new Array(MAX_ROUND); -for (var i = 0; i < MAX_ROUND; i++) { - answers[i] = new Array(CHOICE_NUMBER).fill(0); -}*/ + "心臓がない生き物は?", + "What is the antonym of 'smile' in Japanese?", + "Who is the oldest?", + "What does 'study' mean in Chinese?", + "What part of the animal is 'Teppou' in Yakiniku?", + "Which is the largest country in Africa by area?", + "Which is a real creature?", + "What is the origin of the name of the castanets?", + "Which is named after a person?", + "What kind of shark is a 'Jinbei' in English?", + "Which creature does not have a heart?"]; var choices = [["がっくり", "げっそり", "むっつり", "しっとり"], ["ドナルド・トランプ", "ボリス・ジョンソン", "ウラジーミル・プーチン", "アンゲラ・メルケル"], @@ -417,7 +427,17 @@ ["ハサミの刃", "貝の殻", "栗の実", "両手"], ["そら豆", "えんどう豆", "いんげん豆", "ひよこ豆"], ["エレファント", "ホエール", "ダイナソー", "メガ"], - ["カニ", "ナマコ", "タコ", "ホタテ"]]; + ["カニ", "ナマコ", "タコ", "ホタテ"], + ["Downcast", "Worn out", "Sullen", "Moist"], + ["Donald Trump", "Boris Johnson", "Vladimir Putin", "Angela Merkel"], + ["Belligerent", "Forcefully", "Detailed", "Mean"], + ["Esophagus", "Rectum", "Temple", "Stomach"], + ["Ethiopia", "Libya", "Algeria", "Kenya"], + ["Giraffe Bat", "Lion Bat", "Rabbit Bat", "Wolf Bat"], + ["Scissor blade", "Shell of a clam", "Chestnut", "Both hands"], + ["Broad bean", "Pea", "String bean", "Chickpea"], + ["Elephant", "Whale", "Dinosaur", "Mega"], + ["Crab", "Sea cucumber", "Octopus", "Scallop"]]; var realAnswer = new Array(MAX_ROUND).fill(0); diff --git a/flask/testapp/static/javascript/resultScreen.js b/flask/testapp/static/javascript/resultScreen.js index 4ab91e8..a0ce4d3 100644 --- a/flask/testapp/static/javascript/resultScreen.js +++ b/flask/testapp/static/javascript/resultScreen.js @@ -23,10 +23,15 @@ fText(question[round].choiceC, 275, 725, 25, "white"); fText(question[round].choiceD, 725, 725, 25, "white"); - - fText((round+1) + "回戦", 100, 1000, 50, "red"); - fText("現在の点数: " + player.score + " Pt", 700, 1000, 50, "black"); - + if(language==JPN){ + fText((round+1) + "回戦", 100, 1000, 50, "red"); + fText("現在の点数: " + player.score + " Pt", 700, 1000, 50, "black"); + } + else{ + fText("ROUND " + (round+1), 150, 1000, 50, "red"); + fText("Current Points: " + player.score + " Pt", 650, 1000, 50, "black"); + } + if(scene == GAME_SCENE){ setAlp(50); sRect(45, 880, 865, 40, "black"); @@ -49,7 +54,12 @@ fRect(200, 475, 560, 200, "#208") sRect(200, 475, 560, 200, "black") setAlp(100) - fText("集計中...", 500, 575, 80, "white"); + if(language==JPN){ + fText("集計中...", 500, 575, 80, "white"); + } + else{ + fText("Counting...", 500, 575, 80, "white"); + } } } @@ -84,27 +94,44 @@ fText("ゲームに参加", 480, 600, 50, "white"); } if(scene == CAPASITY_ERROR){ - fTextN("次のゲームが始まるまで\nお待ちください...", 480, 500, 100, 50, "red"); + if(language==JPN){ + fTextN("次のゲームが始まるまで\nお待ちください...", 480, 500, 100, 50, "red"); + } + else{ + fText("Please Wait for Next Game...", 480, 500, 100, 50, "red"); + } } } // 他のプレイヤーが名前を書くのを待機(nemoto変更) function WaitStart(){ + fill("silver"); - fRect(50, 50, 855, 100, "black"); - - fText("美人投票ゲーム", 480, 100, 80, "white"); setAlp(100); - fText("参加予定者:" + max_player + "人", 480, 300, 50, "black"); - fText("現在の参加者:" + current_player + "人", 480, 400, 50, "black"); - fText("参加者が揃うまでお待ちください...", 480, 500, 50, "red"); + if(language==JPN){ + fText("美人投票ゲーム", 480, 100, 80, "white"); + fText("参加予定者:" + max_player + "人", 480, 300, 50, "black"); + fText("現在の参加者:" + current_player + "人", 480, 400, 50, "black"); + fText("参加者が揃うまでお待ちください...", 480, 500, 50, "red"); + } + else{ + fText("Beauty Vote", 480, 100, 80, "white"); + fText("Prospective Participant : " + max_player + " players", 480, 300, 50, "black"); + fText("Current Participant : " + current_player + " players", 480, 400, 50, "black"); + fTextN("Please Wait until\n All Participants are Present...", 480, 500, 50, 50, "red"); + } if(player.number == 0){ fRect(200, 580, 560, 200, "black"); sRect(200, 580, 560, 200, "blue"); setAlp(100); - fText("ゲーム開始!", 480, 680, 50, "white"); + if(language==JPN){ + fText("ゲーム開始!", 480, 680, 50, "white"); + } + else{ + fText("GAME START!", 480, 680, 50, "white"); + } if(tapC == 1){ tapC ++; if(200 <= tapX && tapX <= 760 && 580 <= tapY && tapY <= 780){ @@ -123,15 +150,31 @@ fill("silver"); setAlp(50); fRect(50, 50, 855, 100, "black"); - fText("結果発表 ", 480, 100, 80, "white"); - fRect(45, 370, 865, 700, "white"); - fText("順位", 150, 410, 50, "black"); - fText("ユーザー名", 390, 410, 50, "black"); - fText("スコア", 730, 410, 50, "black"); + + + if(language==JPN){ + fText("結果発表", 480, 100, 80, "white"); + fText("順位", 150, 410, 50, "black"); + fText("ユーザー名", 390, 410, 50, "black"); + fText("スコア", 730, 410, 50, "black"); + fText("結果", 100, 1100, 50, "red"); + } + else{ + fText("RESULT", 480, 100, 80, "white"); + fText("order", 150, 410, 50, "black"); + fText("username", 390, 410, 50, "black"); + fText("score", 730, 410, 50, "black"); + fText("result", 100, 1100, 50, "red"); + } if(scene == RESULT_SCENE){ - fText(player.name+"さんのスコアは" + player.calcScore() + "点です!", 480, 200, 50, "gold"); + if(language==JPN){ + fText(player.name+"さんのスコアは" + player.score + "点です!", 480, 200, 50, "gold"); + } + else{ + fText(player.name+"'s score is " + player.score + "Points!", 480, 200, 50, "gold"); + } let splitOrder = orderTable.split("\n"); for (var i = 0; i < splitOrder.length; i++){ let arr = splitOrder[i].split(" "); // 空白で文字列を分割 @@ -151,7 +194,6 @@ fText(arr[2], 730, 480+60*i, 50, "black"); } } - fText("結果", 100, 1100, 50, "red"); for(var i = 0; i < MAX_ROUND; i ++){ fText((i+1), 480 + 50*i, 1100, 50, "black"); } diff --git a/flask/testapp/templates/testapp/index.html b/flask/testapp/templates/testapp/index.html index 80f26d2..2b35143 100644 --- a/flask/testapp/templates/testapp/index.html +++ b/flask/testapp/templates/testapp/index.html @@ -54,6 +54,7 @@ var username = "{{username}}"; var userNumber = int("{{user_number}}"); var scene = int("{{scene}}"); + var language = int("{{language}}"); diff --git a/flask/testapp/templates/testapp/inputName.html b/flask/testapp/templates/testapp/inputName.html index 920830f..fde80aa 100644 --- a/flask/testapp/templates/testapp/inputName.html +++ b/flask/testapp/templates/testapp/inputName.html @@ -38,7 +38,7 @@ } #introduction{ - background-color: rgb(77, 31, 175); + background-color: darkblue; color: aliceblue; } @@ -55,11 +55,12 @@ font-size: 20px; box-sizing: border-box; padding: 10px 20px; - width:50%; + width:fit-content; border-radius: 4px; /* ボタンの角丸 */ cursor: pointer; /* ポインターをボタンに合わせた時のカーソルスタイル */ } + .right{ text-align: right; } @@ -72,35 +73,65 @@

美人投票ゲーム

あなたの名前を入力してください

+

(Please input your name.)

- -

+ +

使用する言語を選択してください

Please choose your preferred language.

+ 日本語 + English +
+

ルール説明

-

・4択問題に答えて1番目に多数派なら4pt, 2番目に多数派なら3Pt,

+

・ 4択問題に答えて1番目に多数派なら4pt, 2番目に多数派なら3Pt,

3番目に多数派なら2Pt, 4番目に多数派なら1Ptを獲得

・最終的に獲得ポイントが高ければ勝利

・各問題の制限時間は30秒

・途中退出,途中参加は不可

+ +
+

Rules Explanation

+

- Answer the multiple-choice questions and earn points based on your ranking:

+ +

- The player with the highest total points wins.

+

- Each question has a time limit of 30 seconds.

+

- Exiting or joining midway is not allowed.

+
+

美人投票とは?

有名な経済学者のケインズは、玄人筋の行う投資は投票者が100枚の写真の中から最も容貌の美しい6枚を選び、 その選択が投票者全体の平均的な好みに最も近かった者に賞品が与えられるという新聞投票に見立てることができるとした。

各投票者は、自身が最も美しいと思う写真を選ぶのではなく、他の投票者の好みに最もよく合うと思う写真を選択しなければならないことを意味する。

株式投資に関しても、市場参加者(=投票者)の多くが、値上がりするであろう(=容貌が美しいであろう)と判断する銘柄(=写真)を選ぶことが有効な投資方法であるということ。

+

出典:証券用語解説集(野村證券)

+ +
+

What is the Beauty Vote?

+

The famous economist Keynes stated that professional investment can be likened to a newspaper vote where voters choose the 6 most beautiful faces from 100 photos, and the prize is given to the person whose choices are closest to the average taste of all voters.

+

It means that each voter must not choose the photo they think is the most beautiful, but the photo they think best matches the taste of other voters.

+

Regarding stock investment, it means that it is an effective investment method for many market participants (=voters) to choose stocks (=photos) that they judge will appreciate (= will be beautiful).

+

Source: Securities Terminology Explained (Nomura Securities)

+
+ + diff --git a/flask/testapp/views.py b/flask/testapp/views.py index 3995097..1d11e22 100644 --- a/flask/testapp/views.py +++ b/flask/testapp/views.py @@ -11,6 +11,10 @@ WAIT_TIME = 40 +WAIT_START = 6 +CAPASITY_ERROR = 9 + + # 何位まで表示するか(nemoto) max_order = 5 @@ -24,6 +28,7 @@ current_player = MAX_PLAYER + # 各回のゲーム結果を保存 frequent_table = "" @@ -48,11 +53,12 @@ return render_template("testapp/inputName.html") if request.method == "POST": # ゲーム開始時にユーザー数を出しておき,それぞれに識別番号を振る - if request.form.get("username"): + if request.form.get("username") and request.form.get("language"): # ユーザー名を取得し,ユーザー情報を登録 username = request.form.get("username") + language = request.form.get("language") if user_number >= MAX_PLAYER or start_flag: - return render_template("testapp/index.html", scene=9) + return render_template("testapp/index.html", scene=CAPASITY_ERROR, language=language) user[user_number] = username user_number += 1 @@ -63,7 +69,8 @@ "testapp/index.html", username=username, user_number=user_number - 1, - scene=6, + scene=WAIT_START, + language=language )