Add Hidden Finish

This commit is contained in:
bigJIU 2022-11-10 20:12:06 +08:00
parent 3e45a63683
commit 4802f0a20d
9 changed files with 69 additions and 77 deletions

10
.idea/workspace.xml generated
View File

@ -3,9 +3,12 @@
<component name="ChangeListManager">
<list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/IDManager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/annotation.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data/annotation.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/questionare.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data/questionare.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameAnnotation.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameAnnotation.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameOver.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameOver.html" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -159,7 +162,7 @@
<workItem from="1667456828218" duration="24361000" />
<workItem from="1667898094682" duration="1595000" />
<workItem from="1667998268807" duration="2593000" />
<workItem from="1668064138807" duration="1888000" />
<workItem from="1668064138807" duration="4005000" />
</task>
<servers />
</component>
@ -178,7 +181,8 @@
</option>
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/MarioWeb$test.coverage" NAME="test Coverage Results" MODIFIED="1668079915300" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1668079537189" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
<SUITE FILE_PATH="coverage/MarioWeb$test.coverage" NAME="test Coverage Results" MODIFIED="1668079935841" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1668081798673" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py___1_.coverage" NAME="Flask (main.py) (1) Coverage Results" MODIFIED="1668079945407" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
</component>
</project>

View File

@ -2,9 +2,11 @@ import random
import csv
class idManager():
levelNum = 200
timeMin = 1
ip_dic = {}
ip_recent = {}
ip_control = {}
ip_time = {}
def __int__(self):
self.levelNum = 200
@ -32,7 +34,20 @@ class idManager():
self.ip_control[ip] = 0
else:
self.ip_control[ip] = 1
def getTimes(self,ip):
print(self.ip_time[ip])
if ip not in self.ip_time.keys():
return 0
else:
if self.ip_time[ip]>=self.timeMin:
return 1
else:
return 0
def addTimes(self,ip):
if ip not in self.ip_time.keys():
self.ip_time[ip] = 0
self.ip_time[ip] = self.ip_time[ip]+1
return self.ip_time[ip]
def getControl(self,ip):
return self.ip_control[ip]

Binary file not shown.

Binary file not shown.

View File

@ -10,3 +10,11 @@
10.16.33.201,28,73,A
10.27.169.251,160,10,N
10.27.169.251,143,173,N
127.0.0.1,139,181,N
127.0.0.1,58,70,B
127.0.0.1,83,183,N
127.0.0.1,74,191,E
127.0.0.1,22,188,A
127.0.0.1,11,162,A
127.0.0.1,156,22,E
127.0.0.1,47,30,E

1 127.0.0.1 a b anno
10 10.16.33.201 28 73 A
11 10.27.169.251 160 10 N
12 10.27.169.251 143 173 N
13 127.0.0.1 139 181 N
14 127.0.0.1 58 70 B
15 127.0.0.1 83 183 N
16 127.0.0.1 74 191 E
17 127.0.0.1 22 188 A
18 127.0.0.1 11 162 A
19 127.0.0.1 156 22 E
20 127.0.0.1 47 30 E

View File

@ -46,3 +46,8 @@ IP,Style,Frequency,Age,Gender
127.0.0.1,D,E,D,,
127.0.0.1,,,,,
127.0.0.1,D,,,,
127.0.0.1,D,C,G,,
127.0.0.1,D,A,A,A,
127.0.0.1,,,,,
127.0.0.1,,,,,
127.0.0.1,,,,,

1 IP,Style,Frequency,Age,Gender
46 127.0.0.1,D,E,D,,
47 127.0.0.1,,,,,
48 127.0.0.1,D,,,,
49 127.0.0.1,D,C,G,,
50 127.0.0.1,D,A,A,A,
51 127.0.0.1,,,,,
52 127.0.0.1,,,,,
53 127.0.0.1,,,,,

13
main.py
View File

@ -57,12 +57,10 @@ def gameplay(id):
def getJSONData(id):
if request.method == 'POST':
print("POST Game")
# print(request.form)
# print(list(request.form))
resultList = list(request.form)[0].split(",")
print(resultList)
saveFile(replayDataPath, id + resultList[0][:-2], resultList[1:])
return "get!"
return "return!"
@ -77,16 +75,19 @@ def gameanno(id):
@app.route('/annotation/radioresult', methods=['POST'])
def getRadioData():
ip = request.remote_addr
if request.method == 'POST':
print("POST Eval")
result = request.form
print(result)
ip = request.remote_addr
ipRecent = idm.getRecent(ip)
idm.write_csv(annotationPath, [ip, ipRecent[0], ipRecent[1], result["fun"]])
idm.addTimes(ip)
# saveFile(evalDataPath,"gameanno",request.json[0]+request.json[1]+request.json[2])
return render_template("GameOver.html")
finish = idm.getTimes(ip)
return render_template("GameOver.html",finish = finish)

View File

@ -17,7 +17,6 @@
<script src="../templates/Web/dynamics.js"></script>
<script src="../templates/Web/font_3071663_oravow8bb8q.js"></script>
<script src="../templates/data.js"></script>
<!-- Custom styles for this template -->
<link href="../templates/Web/scrolling-nav.css" rel="stylesheet">
<link href="../templates/Web/css2" rel="stylesheet">
@ -221,6 +220,10 @@ function Replay(id){
</script>
<script>
function closeReplayWindow(){
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'hidden';
}
window.onload=function(){
closeReplayWindow();
}

View File

@ -106,58 +106,7 @@
display:block;
line-height:30px;
}
.option-input {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
position: relative;
top: 10px;
right: 0;
bottom: 0;
left: 0;
height: 30px;
width: 30px;
transition: all 0.15s ease-out 0s;
background: #cbd1d8;
border: none;
color: #fff;
cursor: pointer;
display: inline-block;
margin-right: 0.5rem;
outline: none;
position: relative;
z-index: 1000;
}
.option-input:hover {
background: #9faab7;
}
.option-input:checked {
background: #0d007e;
}
.option-input.radio {
border-radius: 50%;
}
.option-input.radio::after {
border-radius: 50%;
}
@keyframes click-wave {
0% {
height: 40px;
width: 40px;
opacity: 0.35;
position: relative;
}
100% {
height: 200px;
width: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0;
}
}
</style>
@ -191,7 +140,17 @@
</div>
</div>
</nav>
<script>
window.onload=function(){
console.log("{{finish}}");
console.log("{{finish}}" == "1")
if("{{finish}}" == "1"){
document.getElementById("Finish").style.visibility = "visible";
}else{
document.getElementById("Finish").style.visibility = "hidden";
}
}
</script>
<section id="Over">
<div class="container">
@ -200,18 +159,17 @@
</h1>
<br>
<button onclick='window.location.href = "/again"'>Play And Annotate Again!</button>
<button>Finish!</button>
<button id = "Finish" onclick="if(firefox) {
var opened=window.open('about:blank','_self');
opened.opener=null;
opened.close();
} else {
window.opener = null;
window.open('', '_self');
window.close();
}
;">Finish!</button>
</div>
<!-- <div class="row clearfix">
<div class="col-md-2"></div>
<div class="col-md-8">
<button onclick="getRadioValue()" class="cirButton"> <h3>Submit</h3> </button>.
<br><br>
</div>
</div> -->
</section>
@ -223,9 +181,7 @@
<footer class="py-5 bg-dark">
<div class="container">
<div class="row clearfix">
<!-- <div class="col-md-2 column">
<img class="img-fluid" alt="" src="../templates/Web/Wechat.png" style="width: 100px;">
</div> -->
<div class="col-md-10 column">
<br><br>
<p class="m-0 text-center text-white">Copyright © Jialin Liu</p>