Update Several Logic
This commit is contained in:
parent
928d98b23f
commit
50644250c6
11
.idea/workspace.xml
generated
11
.idea/workspace.xml
generated
@ -5,20 +5,13 @@
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface.jar" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface.jar.js" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface.jar.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/Play.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/Play.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioGame.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioGame.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioWorld.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioWorld.java" 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/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/GameQuestion.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameQuestion.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GameWelcome.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameWelcome.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/data.js" beforeDir="false" afterPath="$PROJECT_DIR$/templates/data.js" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -214,6 +207,8 @@
|
||||
<workItem from="1670662279126" duration="964000" />
|
||||
<workItem from="1670919169632" duration="2232000" />
|
||||
<workItem from="1671001937679" duration="1407000" />
|
||||
<workItem from="1671278879840" duration="3791000" />
|
||||
<workItem from="1675757773553" duration="7165000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -234,7 +229,7 @@
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/MarioWeb$MarioWeb.coverage" NAME="MarioWeb Coverage Results" MODIFIED="1669305478201" 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="1671002752224" 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="1675781448695" 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___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>
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -11,6 +11,7 @@ import engine.core.MarioResult;
|
||||
import engine.helper.Replay;
|
||||
|
||||
public class Play {
|
||||
private static MarioGame game;
|
||||
public static String getLevel(String filepath) {
|
||||
String content = "";
|
||||
try {
|
||||
@ -46,7 +47,7 @@ public class Play {
|
||||
|
||||
// String levelPath = String.format("./levels/group%s/%s.lvl", "0", levelName); // For local
|
||||
// String repPath = String.format("./reps/%s_sav.rep", levelName); // For local
|
||||
MarioGame game = new MarioGame();
|
||||
game = new MarioGame();
|
||||
game.setLives(lives);
|
||||
MarioResult tmpResult = game.playGame(new HumanAgent(control),getLevel(levelPath), time, repPath,col);
|
||||
|
||||
@ -64,8 +65,11 @@ public class Play {
|
||||
// String levelPath = String.format("/app/levels/group%s/%s.txt", groupID, levelName); // For local
|
||||
// String repPath = String.format("./files/%s_sav.rep", levelName); // For local
|
||||
|
||||
MarioGame game = new MarioGame();
|
||||
game = new MarioGame();
|
||||
game.setLives(lives);
|
||||
game.playGame(Replay.getRepAgentFromFile(repPath),getLevel(levelPath), time, repPath,col);
|
||||
}
|
||||
public static void stopReplay(){
|
||||
game.stopGame();
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +220,9 @@ public class MarioGame {
|
||||
return new MarioResult(this.world, gameEvents, agentEvents);
|
||||
}
|
||||
|
||||
public void stopGame(){
|
||||
this.world.gameStatus = GameStatus.LOSE;
|
||||
}
|
||||
public void setLives(int lives) {
|
||||
this.initialLives = lives;
|
||||
}
|
||||
|
Binary file not shown.
@ -159,3 +159,10 @@ IP,Style,Frequency,Age,Gender
|
||||
10.27.169.251,A,A,A,A,B,A,,
|
||||
10.27.169.251,A,A,A,A,A,A,,
|
||||
10.27.169.251,A,A,D,B,B,A,,
|
||||
127.0.0.1,A,A,A,D,F,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,B,A,A,A,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
|
|
31
main.py
31
main.py
@ -101,8 +101,12 @@ def getRadioData():
|
||||
ipRecent = idm.getRecent(ip)
|
||||
idm.write_csv(annotationPath, [ip, ipRecent[0], ipRecent[1], result["fun"]])
|
||||
|
||||
if idm.getTimes(ip):
|
||||
return redirect(url_for("gameplay2",id=ip))
|
||||
else:
|
||||
idm.addTimes(ip)
|
||||
return redirect(url_for("gameplay",id=ip))
|
||||
|
||||
return redirect(url_for('over', stage=1))
|
||||
|
||||
|
||||
@app.route('/gameplay2')
|
||||
@ -157,18 +161,23 @@ def gameannoresult2(id):
|
||||
idm.write_csv(annotationPath2,
|
||||
[request.remote_addr, resultList[0], resultList[1], resultList[2], levelList[0], levelList[1], levelList[2],
|
||||
""])
|
||||
return redirect(url_for('over', stage=2))
|
||||
|
||||
if idm.getTimes(id):
|
||||
return redirect(url_for("over", id=id))
|
||||
else:
|
||||
idm.addTimes(id)
|
||||
return redirect(url_for("gameplay2", id=id))
|
||||
|
||||
|
||||
@app.route("/gameover/<stage>")
|
||||
def over(stage):
|
||||
finish = idm.getTimes(request.remote_addr)
|
||||
print("finish %d",finish)
|
||||
if finish:
|
||||
idm.setTimes(request.remote_addr)
|
||||
else:
|
||||
idm.addTimes(request.remote_addr)
|
||||
return render_template("GameOver.html", finish=finish, stage=stage)
|
||||
@app.route("/gameover")
|
||||
def over():
|
||||
# finish = idm.getTimes(request.remote_addr)
|
||||
# print("finish %d",finish)
|
||||
# if finish:
|
||||
# idm.setTimes(request.remote_addr)
|
||||
# else:
|
||||
# idm.addTimes(request.remote_addr)
|
||||
return render_template("GameOver.html")
|
||||
|
||||
|
||||
def saveFile(path, filename, content):
|
||||
|
File diff suppressed because one or more lines are too long
@ -241,8 +241,9 @@ function Replay(id){
|
||||
<br><br>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<i class="icon-heart-empty"></i> What's their "fun" rank?
|
||||
<i class="icon-heart-empty"></i> Please rank the above levels in terms of "fun" (from highest to lowest)
|
||||
</h1>
|
||||
<p>[Please drag and drop the boxes below to your favourite ranking]</p>
|
||||
<br>
|
||||
|
||||
<div class="wrapper">
|
||||
|
@ -162,18 +162,21 @@
|
||||
<section id="Over">
|
||||
<div class="container">
|
||||
<h1>
|
||||
<i class="icon-chevron-down"></i> Thank You!!!
|
||||
<i class="icon-chevron-down"></i> Thank You For Playing!!!
|
||||
</h1>
|
||||
<br>
|
||||
<h3>
|
||||
Do you want to play another round?
|
||||
</h3>
|
||||
<button>Yes</button>
|
||||
<button>No</button>
|
||||
<div style="">
|
||||
<button onclick="
|
||||
if('{{stage}}' == '2'){
|
||||
window.location.href = '/gameplay2';
|
||||
}else{
|
||||
window.location.href = '/again'
|
||||
}
|
||||
|
||||
|
||||
|
||||
">Keep Playing!</button>
|
||||
<button id = "Finish" onclick="
|
||||
if('{{stage}}' == '2'){
|
||||
@ -183,8 +186,8 @@
|
||||
|
||||
window.location.href = '/gameplay2';
|
||||
}
|
||||
|
||||
">Finish!</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user