Update Part2

This commit is contained in:
bigJIU 2022-11-24 15:44:32 +08:00
parent f451920a68
commit 4188e697a1
11 changed files with 62 additions and 76 deletions

9
.idea/workspace.xml generated
View File

@ -4,12 +4,13 @@
<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/GameAnnotation2.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameAnnotation2.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameOver.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameOver.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GamePlay.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GamePlay.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GamePlay2.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GamePlay2.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameQuestion.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameQuestion.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameTutorial.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameTutorial.html" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -173,7 +174,7 @@
<workItem from="1668492153120" duration="654000" />
<workItem from="1668520247886" duration="913000" />
<workItem from="1669042021967" duration="608000" />
<workItem from="1669266954441" duration="4319000" />
<workItem from="1669266954441" duration="7584000" />
</task>
<servers />
</component>
@ -193,7 +194,7 @@
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<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="1669267399800" 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_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1669275362710" 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

@ -4,7 +4,7 @@ import csv
class idManager():
levelNum = 200
timeMin = 2
timeMin = 1
tutorialMax = 3
ip_dic = {}
ip_recent = {}
@ -35,6 +35,8 @@ class idManager():
return self.ip_recent[ip]
def getLevel(self, ip):
if ip not in self.ip_dic.keys():
self.ip_dic[ip] = []
level = random.randint(1, self.levelNum)
while level in self.ip_dic[ip]:
level = random.randint(1, self.levelNum)

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,4 @@
IP,A-ID,B-ID,Anno,
127.0.0.1,28,96,A,
127.0.0.1,19,166,A,
127.0.0.1,193,112,E,

1 IP A-ID B-ID Anno
2 127.0.0.1 28 96 A
3 127.0.0.1 19 166 A
4 127.0.0.1 193 112 E

View File

@ -69,3 +69,19 @@ IP,Style,Frequency,Age,Gender
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,D,B,B,A,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,,,,,,
127.0.0.1,A,,,,,

1 IP,Style,Frequency,Age,Gender
69 127.0.0.1,,,,,,
70 127.0.0.1,,,,,,
71 127.0.0.1,D,B,B,A,,
72 127.0.0.1,,,,,,
73 127.0.0.1,,,,,,
74 127.0.0.1,,,,,,
75 127.0.0.1,,,,,,
76 127.0.0.1,,,,,,
77 127.0.0.1,,,,,,
78 127.0.0.1,,,,,,
79 127.0.0.1,,,,,,
80 127.0.0.1,,,,,,
81 127.0.0.1,,,,,,
82 127.0.0.1,,,,,,
83 127.0.0.1,,,,,,
84 127.0.0.1,,,,,,
85 127.0.0.1,,,,,,
86 127.0.0.1,,,,,,
87 127.0.0.1,A,,,,,

11
main.py
View File

@ -100,18 +100,19 @@ def getRadioData():
@app.route('/stage2pre')
def getStage2():
return redirect(url_for('gameplay2', id=request.remote_addr, w = False))
return redirect(url_for('gameplay2', id=request.remote_addr))
@app.route('/stage2game')
def getStage2game():
return redirect(url_for('gameplay2', id=request.remote_addr, w = True))
return redirect(url_for('gameplay2', id=request.remote_addr))
@app.route('/gameplay2/<id>')
def gameplay2(id, w):
return render_template('GamePlay2.html', gamelevel=idm.getLevel(id), control=idm.getControl(id), w=w)
def gameplay2(id):
print("id "+id)
return render_template('GamePlay2.html', gamelevel=idm.getLevel(id), control=idm.getControl(id))
@app.route('/annotation2')

View File

@ -200,18 +200,24 @@
</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>
<script>
function Replay(id){
if(id==1){
console.log("{{level1}}")
console.log("{{level}}")
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", "{{level1}}",5);
}else if(id==2){
console.log("{{level2}}")
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", "{{level2}}",5);
cjCall("Play", "replayGameMain", "{{level}}",5);
}else{
}
@ -244,59 +250,46 @@ function Replay(id){
<br>
<div class="row clearfix">
<div class="col-md-5">
<h4>Level A Review</h4>
<div class="col-md-12">
<h4>Level Review</h4>
<p style="color:darkgrey">Drag Picture To Move</p>
<div style="overflow-x: scroll; height: 350px;" >
<img src="../levels/{{level1}}.png" height="100%">
<img src="../levels/{{level}}.png" height="100%">
</div>
<br><br>
<button onclick="Replay(1)" class="cirButton"><b> Watch Level A Replay</b> </button>
</div>
<div class="col-md-2"></div>
<div class="col-md-5">
<h4>Level B Review</h4>
<p style="color:darkgrey">Drag Picture To Move</p>
<div style="overflow-x: scroll; height: 350px;" >
<img src="../levels/{{level2}}.png" height="100%">
</div>
<br><br>
<button onclick="Replay(2)" class="cirButton"><b> Watch Level B Replay</b> </button>
</div>
</div>
</div>
<br><br>
<div class="container">
<h1>
<i class="icon-cloud"></i> Annotation Questions
<i class="icon-cloud"></i> Annotation Part
</h1>
<br>
<div class="row clearfix">
<br><br>
<div class="col-md-6" align="center" style="visibility: hidden;" id = "again">
<div class="col-md-6" align="center" style="visibility: visible;" id = "again">
<br>
<button onclick="
window.location.href = '/stage2pre'
"><h3>Practice More</h3></button>
</div>
<div class="col-md-6" align="center" style="visibility: hidden;" id = "game">
<div class="col-md-6" align="center" style="visibility: visible;" id = "game">
<br>
<button onclick="
window.location.href = '/stage2game'
"><h3>Play Real Game</h3></button>
</div>
<div class="col-md-6" align="center" style="visibility: hidden;" id = "over">
<div class="col-md-6" align="center" style="visibility: visible;" id = "over">
<br>
<button onclick="
window.location.href = 'about:blank';

View File

@ -17,7 +17,7 @@
<script src="../templates/Web/font_3071663_oravow8bb8q.js"></script>
<script src="./data.js"></script>
<script src="../data.js"></script>
<!-- Custom styles for this template -->
<link href="../templates/Web/scrolling-nav.css" rel="stylesheet">
<link href="../templates/Web/css2" rel="stylesheet">
@ -164,7 +164,7 @@
window.location.href = 'about:blank';
window.close();
}else{
window.location.href = 'about:blank';
window.location.href = '/stage2pre';
}
">Finish!</button>

View File

@ -2,7 +2,6 @@
<!-- saved from url=(0029)http://aingames.cn/index.html -->
<html lang="en"><script id="allow-copy_script">(function t(){var t=!1;document.addEventListener("allow_copy",(function(n){t=n.detail.unlock}));var n=["copy","cut","contextmenu","selectstart","mousedown","mouseup","mousemove","keydown","keypress","keyup"],e=function(n){t&&(n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation())};n.forEach((function(t){document.documentElement.addEventListener(t,e,{capture:!0})}))})()</script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://cjrtnc.leaningtech.com/2.3/loader.js"></script>
<script src="../templates/data.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
@ -119,51 +118,23 @@
<script>
//Init Cheerpj Framework
cheerpjInit();
/*
function cheerpjCreateDisplay(w, h, oldElem)
{
// Create a div element that will contain all Java Windows
var element = document.createElement("div");
cjDisplay = element;
element.id="cheerpjDisplay";
if(oldElem && w<0 && h<0)
{
// Compute the sizes from the parent
element.style.width="100%";
element.style.height="100%";
}
else
{
element.style.width=w+"px";
element.style.height=h+"px";
}
element.classList.add("cheerpjLoading");
element.classList.add("bordered");
if(oldElem)
oldElem.appendChild(element);
else
document.body.appendChild(element);
cheerpjSetStatus(cjStatus, element);
return element;
}*/
var divElement = document.getElementById("GameWindow");
var levels = getLevels("{{gamelevels}}");
var level1 = levels[0];
var level2 = levels[1];
var level = "{{gamelevel}}";
console.log("{{gamelevel}}")
cheerpjCreateDisplay(500,500,divElement);
cheerpjRunMain("Play", "/app/Mario-AI-Interface.jar", "0", "f_l");
console.log("Cheerpj Initialize Succeed!");
console.log("{{control}}")
var control = ("{{control}}" == "1");
PlayLevel(level1,control)
PlayLevel(level,control)
.then(function (){alert("Game Over!")})
.then(PlayLevel(level2,control)
.then(function (){
alert("Go to Evaluation Window")
window.location.href = "/annotation"
}));
window.location.href = "/annotation2"
});
</script>

View File

@ -17,7 +17,7 @@
<script src="../templates/Web/font_3071663_oravow8bb8q.js"></script>
<script src="./data.js"></script>
<script src="../data.js"></script>
<!-- Custom styles for this template -->
<link href="../templates/Web/scrolling-nav.css" rel="stylesheet">
<link href="../templates/Web/css2" rel="stylesheet">