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------- -----------------------------------------------SSSS-SSS-----------------------SSSSSSSSSSSSSSSSSS----------------SSSSSSSSSSSSSSSS----------------S--SSSSSS-------
----------o-----t-------------------------------------------------------------------SSSS--S----------------------SSSSSSSSSSSSSSS-------------------------------- ----------o-----t-----------------S-------------------------------------------------SSSS--S----------------------SSSSSSSSSSSSSSS--------------------------------
%--------S------t--------------------------------------------------------------------SS--SSS--------------------SSSSSSSSSSSSSSS--------------------------------- %--------S------t--------------------------------------------------------------------SS--SSS--------------------SSSSSSSSSSSSSSS---------------------------------
|------------------------------o----------SSSSSS--------------------Q--------------S------SS-------------------o------S----KSSS---------------@%--S------------- |------------------------------o----------SSSSSS--------------------Q--------------S------SS-------------------o------S----KSSS---------------@%--S-------------
|-----------------------------------------SSSSS------oo----------------------------------------------%---------------------SS------------------|---------------- |---------------------------------S-------SSSSS------oo----------------------------------------------%---------------------SS------------------|----------------
|--------------------------------------SSSSSSSS-%----%%%%%-%%--------------------------SS------------|-----------------------------------------|-----#---------- |--------------------------------------SSSSSSSS-%----%%%%%-%%--------------------------SS------------|-----------------------------------------|-----#----------
|--------o------------------------S--SS--SSSSS--|-----|||--||--------------------------r-------S-----|------------SSo-ooo---oSSS---------------|----##---------- |--------o------------------------S--SS--SSSSS--|-----|||--||--------------------------r-------S-----|------------SSo-ooo---oSSS---------------|----##----------
|------------------------------S----SSSSSSSSSSS-|-----|||--||-------------------%%%%%%%%%%------QQQ--|-QQ----------SSS%--%%%%%%%---#-----------|---####--##-##-# |------------------------------S----SSSSSSSSSSS-|-----|||--||-------------------%%%%%%%%%%------QQQ--|-QQ----------SSS%--%%%%%%%---#-----------|---####--##-----
|------------------------------t--------S-------|-T---|||--||----------------#---||||||||----#-------|----------------|---|||||----#-----------|--#####--##----# |------------------------------t--------S-------|-T---|||--||----------------#---||||||||----#-------|----------------|---|||||----#-----------|--#####--##-----
|--------------------------tt--t-------SSS%%-SS-|-TT--|||--||----------------#--S|||||||S----#-------tt---------S-----|--S||||S----#-----------|-######--##----# |--------------------------tt--t-------SSS%%-SS-|-TT--|||--||----------------#--S|||||||S----#-------tt---------S-----|--S||||S----#-----------|-######--##-----
|--------k-------g---------tt-kt----------||----|-TT--|||--||----kkg-------###---|||||||---------g---tt------ggg------|---||||-----#-#---------|#######--##----# |--------k-------g---------tt-kt----------||----|-TT--|||--||----kkg-------###---|||||||---------g---tt------ggg------|---||||-----#-#---------|#######--##-----
XX-------XXXXXXXXXXXXXXXXXXXXXXXS--%------%%----|XXXX-|||--||---XXXXXXXXXXXXXXXX%|%%%%%%%-------XXXXXXXXXXXXXXXX-%%%%%%%%%%%||--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X XX-------XXXXXXXXXXXXXXXXXXXXXXXS--%------%%----|XXXX-|||--||---XXXXXXXXXXXXXXXX%|%%%%%%%-------XXXXXXXXXXXXXXXX-%%%%%%%%%%%||--XXXXXXXXXXXXXXXXXXXXXXXXXXXX----
XX-------XXXXXXXXXXXXXXXXXXXXXXX---|------||----|XXXX-|||--||---XXXXXXXXXXXXXXXXg|-|||||--------XXXXXXXXXXXXXXXXg-|||||||||-||--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X 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 { public static void main(String[] args) throws IOException {
//FIXME: Debug Use //FIXME: Debug Use
//playGameMain("lvl1"); // game = new MarioGame();
// initialGame();
// playJavaGame(); // playJavaGame();
System.out.println("Java: Play Java Main Function Done"); 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) { 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 = new MarioWorld(this.killEvents);
this.world.visuals = visual; this.world.visuals = visual;
this.world.initializeLevel(level, 1000 * timer); this.world.initializeLevel(level, 1000 * timer);
@ -153,7 +154,8 @@ public class MarioGame extends KeyAdapter{
this.world.lives = this.initialLives; this.world.lives = this.initialLives;
this.world.mario.isLarge = marioState > 0; this.world.mario.isLarge = marioState > 0;
this.world.mario.isFire = marioState > 1; this.world.mario.isFire = marioState > 1;
this.world.update(new boolean[MarioActions.numberOfActions()]);
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
//initialize graphics //initialize graphics
@ -221,6 +223,7 @@ public class MarioGame extends KeyAdapter{
// update world // update world
this.world.update(actions); this.world.update(actions);
//System.out.println((int) this.world.mario.y / 16);
gameEvents.addAll(this.world.lastFrameEvents); gameEvents.addAll(this.world.lastFrameEvents);
agentEvents.add(new MarioAgentEvent(actions, this.world.mario.x, 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), 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() { public void revive() {
int newTileX = (int) this.mario.x / 16; int newTileX = (int) this.mario.x / 16;
int newTileY = (int) this.mario.y / 16; int newTileY = (int) this.mario.y / 16;
int direction = 1;
try { try {
l: while (true) { l: while (true) {
//System.out.println(newTileX); if(newTileX<this.level.tileWidth){
for (int y = this.level.tileHeight - 2; y >= 8; y--) { //for (int y = this.level.tileHeight-2; y >= 8; y--) {
if (this.level.standable(newTileX, y)) { for (int y = 0; y <= this.level.tileHeight-2; y++) {
newTileY = y; if (this.level.standable(newTileX, y)) {
break l; newTileY = y;
break l;
}
} }
newTileX+=direction;
}else{
direction = -1;
newTileX = (int) this.mario.x / 16;
} }
newTileX++;
} }
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
this.lose(); this.lose();

View File

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