Fixed Engine Bug, Update Features
This commit is contained in:
parent
79c49034c5
commit
f7be38c963
14
.idea/workspace.xml
generated
14
.idea/workspace.xml
generated
@ -5,17 +5,16 @@
|
||||
<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/src/Play.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/Play.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/agents/HumanAgent.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/agents/HumanAgent.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/agents/ReplayAgent.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/agents/ReplayAgent.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$/Mario-AI-Interface/src/engine/helper/MarioActions.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/helper/MarioActions.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/GamePlay.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GamePlay.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GameTutorial.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameTutorial.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/data.js" beforeDir="false" afterPath="$PROJECT_DIR$/templates/data.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GameOver.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameOver.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GameWelcome.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameWelcome.html" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -219,6 +218,7 @@
|
||||
<workItem from="1676991343098" duration="1013000" />
|
||||
<workItem from="1677221941122" duration="2329000" />
|
||||
<workItem from="1677303698061" duration="6278000" />
|
||||
<workItem from="1677563906178" duration="4152000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -240,6 +240,6 @@
|
||||
<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="1677224605926" 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="1677309921250" 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="1677566663144" 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
@ -28,7 +28,7 @@ public class HumanAgent extends KeyAdapter implements MarioAgent {
|
||||
return actions.clone();
|
||||
}else{
|
||||
System.out.println("return true");
|
||||
return new boolean[]{true, false, true, true, true};
|
||||
return new boolean[]{true, false, true, true, true, true};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ public class ReplayAgent extends KeyAdapter implements MarioAgent {
|
||||
public boolean[] getActions(MarioForwardModel model, MarioTimer timer) {
|
||||
if(!isPressed){
|
||||
if (p >= actions.length)
|
||||
return new boolean[5];
|
||||
return new boolean[6];
|
||||
return this.actions[p++];
|
||||
}else{
|
||||
System.out.println("return true");
|
||||
return new boolean[]{true, true, false, true, true};
|
||||
return new boolean[]{false, true, true, true, true, true};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -197,16 +197,16 @@ public class MarioGame extends KeyAdapter{
|
||||
replayBreak = true;
|
||||
}
|
||||
// Mid Break & Cheat Mode
|
||||
if(actions[0]&&actions[1]){
|
||||
this.world.lose();
|
||||
replayBreak = true;
|
||||
//break;
|
||||
}
|
||||
if(actions[0]&&actions[2]){
|
||||
if(actions[0]&&!actions[1]&&actions[2]&&actions[3]&&actions[4]&&actions[5]){
|
||||
this.world.lose();
|
||||
cheatBreak = true;
|
||||
//break;
|
||||
}
|
||||
if(!actions[0]&&actions[1]&&actions[2]&&actions[3]&&actions[4]&&actions[5]){
|
||||
this.world.lose();
|
||||
replayBreak = true;
|
||||
//break;
|
||||
}
|
||||
|
||||
// update world
|
||||
this.world.update(actions);
|
||||
@ -257,8 +257,6 @@ public class MarioGame extends KeyAdapter{
|
||||
stopGame();
|
||||
System.out.println("Pressed mg");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public void setLives(int lives) {
|
||||
|
@ -5,7 +5,8 @@ public enum MarioActions {
|
||||
RIGHT(1, "Right"),
|
||||
DOWN(2, "Down"),
|
||||
SPEED(3, "Speed"),
|
||||
JUMP(4, "Jump");
|
||||
JUMP(4, "Jump"),
|
||||
DONE(5,"Done");
|
||||
|
||||
private int value;
|
||||
private String name;
|
||||
|
@ -27,3 +27,5 @@ IP,A-ID,B-ID,Anno,
|
||||
127.0.0.1,75,17,N,
|
||||
127.0.0.1,69,73,N,
|
||||
127.0.0.1,31,125,N,
|
||||
127.0.0.1,56,57,N,
|
||||
127.0.0.1,200,144,N,
|
||||
|
|
@ -195,3 +195,8 @@ IP,Style,Frequency,Age,Gender
|
||||
127.0.0.1,C,A,D,B,E,A,,
|
||||
127.0.0.1,C,A,A,A,G,A,,
|
||||
127.0.0.1,C,A,B,B,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,C,A,D,A,E,A,,
|
||||
127.0.0.1,A,A,A,E,B,C,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
127.0.0.1,A,A,A,A,A,A,,
|
||||
|
|
24
main.py
24
main.py
@ -19,9 +19,10 @@ annotationPath2 = "data/annotation2.csv"
|
||||
|
||||
@app.route('/')
|
||||
def gamewelcome():
|
||||
#return redirect(url_for('gameplay', id=request.remote_addr))
|
||||
# return redirect(url_for('gameplay', id=request.remote_addr))
|
||||
return render_template('GameWelcome.html')
|
||||
|
||||
|
||||
@app.route('/question')
|
||||
def gamequestion():
|
||||
return render_template('GameQuestion.html')
|
||||
@ -46,12 +47,13 @@ def gamepreplay():
|
||||
print(result.get("gamestyle"))
|
||||
return redirect(url_for('gametutorial', id=ip))
|
||||
# debug use:
|
||||
#return redirect(url_for('gameanno2', id=ip))
|
||||
# return redirect(url_for('gameanno2', id=ip))
|
||||
|
||||
|
||||
@app.route('/gametutorial/<id>')
|
||||
def gametutorial(id):
|
||||
return render_template('GameTutorial.html', tutorial=idm.addTutorial(id), next=idm.hasNextTutorial(id),control=idm.getControl(id))
|
||||
return render_template('GameTutorial.html', tutorial=idm.addTutorial(id), next=idm.hasNextTutorial(id),
|
||||
control=idm.getControl(id))
|
||||
|
||||
|
||||
@app.route('/again')
|
||||
@ -71,7 +73,6 @@ def gameplay(id):
|
||||
jump="/annotation")
|
||||
|
||||
|
||||
|
||||
@app.route('/gameplay/<id>/data', methods=['POST'])
|
||||
def getJSONData(id):
|
||||
if request.method == 'POST':
|
||||
@ -87,7 +88,6 @@ def gamepreanno():
|
||||
return redirect(url_for('gameanno', id=request.remote_addr))
|
||||
|
||||
|
||||
|
||||
@app.route('/annotation/<id>')
|
||||
def gameanno(id):
|
||||
if (id != "radioresult"):
|
||||
@ -111,11 +111,10 @@ def getRadioData():
|
||||
idm.write_csv(annotationPath, [ip, ipRecent[0], ipRecent[1], result["fun"]])
|
||||
|
||||
if idm.getTimes(ip):
|
||||
return redirect(url_for("gameplay2",id=ip))
|
||||
return redirect(url_for("gameplay2", id=ip))
|
||||
else:
|
||||
idm.addTimes(ip)
|
||||
return redirect(url_for("gameplay",id=ip))
|
||||
|
||||
return redirect(url_for("gameplay", id=ip))
|
||||
|
||||
|
||||
@app.route('/gameplay2')
|
||||
@ -150,7 +149,7 @@ def gameanno2(id):
|
||||
if id != "result":
|
||||
print("anno " + id)
|
||||
gamelevels = idm.getRecent(id)
|
||||
#gamelevels = idm.getTypeLevels(id)
|
||||
# gamelevels = idm.getTypeLevels(id)
|
||||
level1 = gamelevels[0]
|
||||
level2 = gamelevels[1]
|
||||
level3 = gamelevels[2]
|
||||
@ -168,7 +167,8 @@ def gameannoresult2(id):
|
||||
print(resultList)
|
||||
|
||||
idm.write_csv(annotationPath2,
|
||||
[request.remote_addr, resultList[0], resultList[1], resultList[2], levelList[0], levelList[1], levelList[2],
|
||||
[request.remote_addr, resultList[0], resultList[1], resultList[2], levelList[0], levelList[1],
|
||||
levelList[2],
|
||||
""])
|
||||
|
||||
if idm.getTimes(id):
|
||||
@ -180,13 +180,13 @@ def gameannoresult2(id):
|
||||
|
||||
@app.route("/gameover")
|
||||
def over():
|
||||
# finish = idm.getTimes(request.remote_addr)
|
||||
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")
|
||||
return render_template("GameOver.html", finish=1, stage=1)
|
||||
|
||||
|
||||
def saveFile(path, filename, content):
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
.popwindow {
|
||||
width:500px;
|
||||
height:550px;
|
||||
height:580px;
|
||||
border:3px solid #ff928e;
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
|
@ -152,9 +152,9 @@
|
||||
fini.style.visibility = "visible";
|
||||
if('{{stage}}' == '2'){
|
||||
fini.innerText = "Finish"
|
||||
}else{
|
||||
fini.innerText = "Go to Phase II"
|
||||
}
|
||||
}else{
|
||||
fini.innerText = "Go to Phase II"
|
||||
}
|
||||
|
||||
}else{
|
||||
fini.style.visibility = "hidden";
|
||||
@ -171,8 +171,8 @@
|
||||
<h3>
|
||||
Do you want to play another round?
|
||||
</h3>
|
||||
<button>Yes</button>
|
||||
<button>No</button>
|
||||
<button onclick="window.location.href = '/gameplay2';">Yes</button>
|
||||
<button onclick="window.location.href = 'about:blank';">No</button>
|
||||
<div style="">
|
||||
<button onclick="
|
||||
if('{{stage}}' == '2'){
|
||||
@ -180,16 +180,15 @@
|
||||
}else{
|
||||
window.location.href = '/again'
|
||||
}
|
||||
">Keep Playing!</button>
|
||||
" style="visibility: hidden">Keep Playing!</button>
|
||||
<button id = "Finish" onclick="
|
||||
if('{{stage}}' == '2'){
|
||||
window.location.href = 'about:blank';
|
||||
window.close();
|
||||
}else{
|
||||
|
||||
window.location.href = '/gameplay2';
|
||||
}
|
||||
">Finish!</button>
|
||||
" style="visibility: hidden">Finish!</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -224,7 +224,7 @@
|
||||
justify-content: center;
|
||||
min-width: fit-content;
|
||||
">
|
||||
<img src="../img/welcome.png" >
|
||||
<img src="../img/frameworkAD.gif" >
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
@ -238,7 +238,8 @@
|
||||
<ul>
|
||||
<li> This experiment consists of two phases, In each phase you will first be asked to play a number of Super Mario Bros games
|
||||
and then will be asked some questions about the levels you just played.
|
||||
<li> It takes about <b>15 minutes in total</b> to complete the experiment.<br>
|
||||
|
||||
<li> You will play <b>the tutorial level and 2 + 2 + 3 = 7 levels</b> of game during the experiment. It takes about <b>15 minutes in total</b> to complete the experiment.<br>
|
||||
<li> Have Fun!
|
||||
</ul>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user