Update Revive policy

This commit is contained in:
bigJIU 2023-03-28 14:03:23 +08:00
parent fa6f873ac1
commit 5d6357ceba
8 changed files with 34 additions and 21 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -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.

View File

@ -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");
}

View File

@ -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),

View File

@ -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();

View File

@ -15,7 +15,7 @@ print = logging.getLogger().info
app = Flask(__name__, static_folder='')
idm = idManager()
app.secret_key = 'fkdjsafjdkfdlkjfadskjfadskljdsfklj'
app.secret_key = 'asdfasdfawefaewvaf'
replayDataPath = "reps/"
evalDataPath = "evals/"
@ -31,9 +31,14 @@ def getId():
@app.route('/')
def gamewelcome():
ip = getId()
return redirect(url_for('gamewelcomeTest',id = ip))
# return redirect(url_for('gameplay', id=request.remote_addr))
return render_template('GameWelcome.html')
# return render_template('GameWelcome.html')
@app.route('/<id>')
def gamewelcomeTest(id):
return render_template('GameWelcome.html')
@app.route('/question')
def gamequestion():