Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
b89f682bf2
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,3 +35,4 @@ __pycache__/IDManager.cpython-39.pyc
|
||||
*.pyc
|
||||
*.pyc
|
||||
questionare.csv
|
||||
log.txt
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -2,15 +2,15 @@
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-----------------------------------------------SSSS-SSS-----------------------SSSSSSSSSSSSSSSSSS----------------SSSSSSSSSSSSSSSS----------------S--SSSSSS-------
|
||||
----------o-----t-------------------------------------------------------------------SSSS--S----------------------SSSSSSSSSSSSSSS--------------------------------
|
||||
----------o-----t-----------------S-------------------------------------------------SSSS--S----------------------SSSSSSSSSSSSSSS--------------------------------
|
||||
%--------S------t--------------------------------------------------------------------SS--SSS--------------------SSSSSSSSSSSSSSS---------------------------------
|
||||
|------------------------------o----------SSSSSS--------------------Q--------------S------SS-------------------o------S----KSSS---------------@%--S-------------
|
||||
|-----------------------------------------SSSSS------oo----------------------------------------------%---------------------SS------------------|----------------
|
||||
|---------------------------------S-------SSSSS------oo----------------------------------------------%---------------------SS------------------|----------------
|
||||
|--------------------------------------SSSSSSSS-%----%%%%%-%%--------------------------SS------------|-----------------------------------------|-----#----------
|
||||
|--------o------------------------S--SS--SSSSS--|-----|||--||--------------------------r-------S-----|------------SSo-ooo---oSSS---------------|----##----------
|
||||
|------------------------------S----SSSSSSSSSSS-|-----|||--||-------------------%%%%%%%%%%------QQQ--|-QQ----------SSS%--%%%%%%%---#-----------|---####--##-##-#
|
||||
|------------------------------t--------S-------|-T---|||--||----------------#---||||||||----#-------|----------------|---|||||----#-----------|--#####--##----#
|
||||
|--------------------------tt--t-------SSS%%-SS-|-TT--|||--||----------------#--S|||||||S----#-------tt---------S-----|--S||||S----#-----------|-######--##----#
|
||||
|--------k-------g---------tt-kt----------||----|-TT--|||--||----kkg-------###---|||||||---------g---tt------ggg------|---||||-----#-#---------|#######--##----#
|
||||
XX-------XXXXXXXXXXXXXXXXXXXXXXXS--%------%%----|XXXX-|||--||---XXXXXXXXXXXXXXXX%|%%%%%%%-------XXXXXXXXXXXXXXXX-%%%%%%%%%%%||--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X
|
||||
XX-------XXXXXXXXXXXXXXXXXXXXXXX---|------||----|XXXX-|||--||---XXXXXXXXXXXXXXXXg|-|||||--------XXXXXXXXXXXXXXXXg-|||||||||-||--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X
|
||||
|------------------------------S----SSSSSSSSSSS-|-----|||--||-------------------%%%%%%%%%%------QQQ--|-QQ----------SSS%--%%%%%%%---#-----------|---####--##-----
|
||||
|------------------------------t--------S-------|-T---|||--||----------------#---||||||||----#-------|----------------|---|||||----#-----------|--#####--##-----
|
||||
|--------------------------tt--t-------SSS%%-SS-|-TT--|||--||----------------#--S|||||||S----#-------tt---------S-----|--S||||S----#-----------|-######--##-----
|
||||
|--------k-------g---------tt-kt----------||----|-TT--|||--||----kkg-------###---|||||||---------g---tt------ggg------|---||||-----#-#---------|#######--##-----
|
||||
XX-------XXXXXXXXXXXXXXXXXXXXXXXS--%------%%----|XXXX-|||--||---XXXXXXXXXXXXXXXX%|%%%%%%%-------XXXXXXXXXXXXXXXX-%%%%%%%%%%%||--XXXXXXXXXXXXXXXXXXXXXXXXXXXX----
|
||||
XX-------XXXXXXXXXXXXXXXXXXXXXXX---|------||----|XXXX-|||--||---XXXXXXXXXXXXXXXXg|-|||||--------XXXXXXXXXXXXXXXXg-|||||||||-||--XXXXXXXXXXXXXXXXXXXXXXXXXXXX----
|
||||
|
Binary file not shown.
@ -24,8 +24,7 @@ public class Play {
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
//FIXME: Debug Use
|
||||
//playGameMain("lvl1");
|
||||
// initialGame();
|
||||
// game = new MarioGame();
|
||||
// playJavaGame();
|
||||
System.out.println("Java: Play Java Main Function Done");
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ public class MarioGame extends KeyAdapter{
|
||||
}
|
||||
|
||||
private MarioResult gameLoop(String level, int timer, int marioState, boolean visual, int fps, String resultPath, int col) {
|
||||
|
||||
this.world = new MarioWorld(this.killEvents);
|
||||
this.world.visuals = visual;
|
||||
this.world.initializeLevel(level, 1000 * timer);
|
||||
@ -153,7 +154,8 @@ public class MarioGame extends KeyAdapter{
|
||||
this.world.lives = this.initialLives;
|
||||
this.world.mario.isLarge = marioState > 0;
|
||||
this.world.mario.isFire = marioState > 1;
|
||||
this.world.update(new boolean[MarioActions.numberOfActions()]);
|
||||
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
//initialize graphics
|
||||
@ -221,6 +223,7 @@ public class MarioGame extends KeyAdapter{
|
||||
|
||||
// update world
|
||||
this.world.update(actions);
|
||||
//System.out.println((int) this.world.mario.y / 16);
|
||||
gameEvents.addAll(this.world.lastFrameEvents);
|
||||
agentEvents.add(new MarioAgentEvent(actions, this.world.mario.x,
|
||||
this.world.mario.y, (this.world.mario.isLarge ? 1 : 0) + (this.world.mario.isFire ? 1 : 0),
|
||||
|
@ -234,16 +234,22 @@ public class MarioWorld {
|
||||
public void revive() {
|
||||
int newTileX = (int) this.mario.x / 16;
|
||||
int newTileY = (int) this.mario.y / 16;
|
||||
int direction = 1;
|
||||
try {
|
||||
l: while (true) {
|
||||
//System.out.println(newTileX);
|
||||
for (int y = this.level.tileHeight - 2; y >= 8; y--) {
|
||||
if(newTileX<this.level.tileWidth){
|
||||
//for (int y = this.level.tileHeight-2; y >= 8; y--) {
|
||||
for (int y = 0; y <= this.level.tileHeight-2; y++) {
|
||||
if (this.level.standable(newTileX, y)) {
|
||||
newTileY = y;
|
||||
break l;
|
||||
}
|
||||
}
|
||||
newTileX++;
|
||||
newTileX+=direction;
|
||||
}else{
|
||||
direction = -1;
|
||||
newTileX = (int) this.mario.x / 16;
|
||||
}
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
this.lose();
|
||||
|
9
main.py
9
main.py
@ -6,10 +6,16 @@ import uuid
|
||||
from IDManager import idManager
|
||||
|
||||
from flask import Flask, render_template, request, redirect, url_for, session
|
||||
import logging
|
||||
|
||||
# 设置logging模块
|
||||
logging.basicConfig(filename='log.txt', level=logging.DEBUG)
|
||||
# 将print输出重定向到logging模块
|
||||
print = logging.getLogger().info
|
||||
|
||||
app = Flask(__name__, static_folder='')
|
||||
idm = idManager()
|
||||
app.secret_key = 'fkdjsafjdkfdlkjfadskjfadskljdsfklj'
|
||||
app.secret_key = 'asdfasdfawefaewvaf'
|
||||
replayDataPath = "reps/"
|
||||
evalDataPath = "evals/"
|
||||
|
||||
@ -25,6 +31,7 @@ def getId():
|
||||
|
||||
@app.route('/')
|
||||
def gamewelcome():
|
||||
ip = getId()
|
||||
# return redirect(url_for('gameplay', id=request.remote_addr))
|
||||
return render_template('GameWelcome.html')
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
||||
</h1>
|
||||
<br>
|
||||
<h3 id="question">
|
||||
Do you want to play another round?
|
||||
Do you want to play again from the second phase?
|
||||
</h3>
|
||||
<br>
|
||||
<button onclick="window.location.href = '/gameplay2';" class="cirButton">Yes</button>
|
||||
|
@ -294,18 +294,18 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<h4>3. Which player type represents you the best in Super Mario Bros?</h4>
|
||||
<h4>3. Which following selection represents you the best in Super Mario Bros?</h4>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="gamestyle" value="A">
|
||||
Runner: try to complete a level as fast as possible by running and jumping
|
||||
Trying to complete a level as fast as possible by running and jumping
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="gamestyle" value="B">
|
||||
Killer: prefer killing all the monsters in a level
|
||||
Prefer killing all the monsters in a level
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="gamestyle" value="C">
|
||||
Collector: attempt to collect all the coins in a level
|
||||
Attempt to collect all the coins in a level
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="gamestyle" value="D">
|
||||
@ -340,21 +340,10 @@
|
||||
<p>
|
||||
<h4>5. What is your age?</h4>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="age" value="A">
|
||||
Below 20
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="age" value="B">
|
||||
20-39
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="age" value="C">
|
||||
40-59
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="age" value="D">
|
||||
Over 60
|
||||
<input type="radio" class="option-input radio" name="age" value="">
|
||||
<input type="number" value="" step="1" placeholder="Input your age">
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="age" value="E">
|
||||
Prefer not to say
|
||||
@ -375,9 +364,23 @@
|
||||
<input type="radio" class="option-input radio" name="gender" value="C">
|
||||
Prefer not to say
|
||||
</label>
|
||||
<script>
|
||||
function renew( ){
|
||||
|
||||
$("input[name='gender']").val($("input[type='text']").val())
|
||||
$("input[name='age']").val($("input[type='number']").val())
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<label>
|
||||
<input type="radio" class="option-input radio" name="gender" value="C">
|
||||
Not listed
|
||||
<input type="radio" class="option-input radio" name="gender" value=" ">
|
||||
Other:
|
||||
<input type="text" value="">
|
||||
|
||||
</label>
|
||||
</p>
|
||||
|
||||
@ -397,7 +400,7 @@
|
||||
|
||||
<br>
|
||||
<p><b><input type="submit" value="Submit" class="cirButton"
|
||||
style="font-weight: 700; font-size: large; width: 60%;" /></b></p>
|
||||
style="font-weight: 700; font-size: large; width: 60%;" onclick ="renew()" /></b></p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
@ -212,19 +212,24 @@
|
||||
</nav>
|
||||
|
||||
|
||||
<section style="background-color: rgba(255,255,255,0.5);">
|
||||
<section style="background-color: rgb(255, 255, 255);">
|
||||
|
||||
<div class="container" style="font-weight: 600;
|
||||
background-color: rgba(255,255,255,0.7);">
|
||||
<div class="container" style="font-weight: 600
|
||||
;">
|
||||
|
||||
<div class="row clearfix" >
|
||||
<!-- <style=" background-color: rgba(255,255,255);height: 130vh;
|
||||
margin-top: -90px;"> -->
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12" style=" background-color: rgba(255,255,255);" >
|
||||
<div align="center">
|
||||
|
||||
<h3>Super Mario Bros Tutorial</h3>
|
||||
Before proceeding to the main part of the experiment please familiarize yourself with the game.<br>
|
||||
You may proceed to the next phase of this survey once you are ready!
|
||||
<br>
|
||||
<p > Before proceeding to the main part of the experiment please familiarize yourself with the game.<br>
|
||||
You may proceed to the next phase of this survey once you are ready!</p>
|
||||
|
||||
<b onclick="replay()" style="cursor: pointer;">Click <u style="color:blue; ">ME</u> to show the instruction page again.</b>
|
||||
|
||||
<p class="alert">If the game is not responding to your keyboard, please click on the game screen.</p>
|
||||
</div>
|
||||
|
||||
@ -283,31 +288,32 @@
|
||||
<h3>Play Game</h3>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="countdown"
|
||||
style="z-index:999; position:absolute; left:50px; bottom: 20px; color: #ffffff; font-size: xx-large; background-color: rgba(0, 0, 0, 0.3);">
|
||||
style="z-index:999; position:absolute; left:50px; bottom: 20px; color: #ffffff; font-size: xx-large; ">
|
||||
</div>
|
||||
<img style=" height: 90vh;bottom: 3.5vh; left: 0vw;
|
||||
position: absolute;z-index: 900; visibility: visible; width: 100%;" src="../templates/Web/pic.png"
|
||||
id="windowshow">
|
||||
<script>
|
||||
function countdown() {
|
||||
var count = 10; // 设置倒计时秒数
|
||||
var timer = setInterval(function () {
|
||||
count--;
|
||||
if (count <= 0) {
|
||||
clearInterval(timer);
|
||||
$("#countdown").hide();
|
||||
$("#windowshow:visible").hide(); // 倒计时结束后隐藏倒计时容器
|
||||
// var count = 10; // 设置倒计时秒数
|
||||
// var timer = setInterval(function () {
|
||||
// count--;
|
||||
// if (count <= 0) {
|
||||
// clearInterval(timer);
|
||||
// $("#countdown").hide();
|
||||
// $("#windowshow:visible").hide(); // 倒计时结束后隐藏倒计时容器
|
||||
|
||||
} else {
|
||||
$("#countdown").html("This instruction will close in " + count + "s. <br>Or click to close."); // 更新倒计时容器内容
|
||||
// } else {
|
||||
$("#countdown").html("Click to close."); // 更新倒计时容器内容
|
||||
$("#windowshow").click(function () {
|
||||
$("#windowshow").hide();
|
||||
$("#countdown").hide();
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});}
|
||||
// }
|
||||
// }, 1000);
|
||||
// }
|
||||
|
||||
$(document).ready(function () {
|
||||
countdown();
|
||||
@ -365,7 +371,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div id="mask" onclick="replay()"></div>
|
||||
<script>
|
||||
function replay() {
|
||||
|
||||
|
@ -272,9 +272,10 @@
|
||||
<li> This experiment has <b>three phases</b>.
|
||||
<ol style="list-style-type: lower-roman;">
|
||||
<li>First you must answer <b>a questionnaire</b>. </li>
|
||||
<li>Then you will complete a <b>short game tutorial</b>, play<b> 2 levels</b> of the game and answer a simple
|
||||
question. You can <b>repeats</b> this phase as you like. </li>
|
||||
<li>Then you will complete a <b>short game tutorial</b>, play<b> 2 levels</b> of the game and answer a
|
||||
simple question. You will play<b> another 2 levels</b>. </li>
|
||||
<li>Finally you will play <b>3 levels</b> and answer a simple question.</li>
|
||||
<li>You can also replay the second phase after finishing the whole process.</li>
|
||||
</ol>
|
||||
<li>In total, the experiment takes approximately <b>15 minutes</b> to complete.</li>
|
||||
<li> Have Fun!
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 336 KiB |
Loading…
Reference in New Issue
Block a user