Update Web Live System

This commit is contained in:
bigJIU 2022-11-03 23:26:25 +08:00
parent 56b88f0c5a
commit a3c50234d7
11 changed files with 39 additions and 39 deletions

11
.idea/workspace.xml generated
View File

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment=""> <list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment="" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/data.js" beforeDir="false" afterPath="$PROJECT_DIR$/templates/data.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -114,7 +109,7 @@
<workItem from="1666752468427" duration="1563000" /> <workItem from="1666752468427" duration="1563000" />
<workItem from="1667205217155" duration="3357000" /> <workItem from="1667205217155" duration="3357000" />
<workItem from="1667357110859" duration="5735000" /> <workItem from="1667357110859" duration="5735000" />
<workItem from="1667456828218" duration="21349000" /> <workItem from="1667456828218" duration="21647000" />
</task> </task>
<servers /> <servers />
</component> </component>
@ -149,6 +144,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1667488394064" 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_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1667488617748" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
</component> </component>
</project> </project>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -23,14 +23,14 @@ public class Play {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String groupID = args[0]; String groupID = args[0];
String levelName = args[1]; String levelName = args[1];
MarioGame game = new MarioGame(); //MarioGame game = new MarioGame();
// String levelPath = String.format("/app/levels/group%s/%s.txt", groupID, levelName); // For web // String levelPath = String.format("/app/levels/group%s/%s.txt", groupID, levelName); // For web
// String repPath = String.format("/files/tmp.rep"); // For web // String repPath = String.format("/files/tmp.rep"); // For web
game.setLives(10); // game.setLives(10);
String levelPath = String.format("./levels/group%s/%s.txt", groupID, levelName); // For local // String levelPath = String.format("./levels/group%s/%s.txt", groupID, levelName); // For local
String repPath = String.format("./reps/%s_sav.rep", levelName); // For local // String repPath = String.format("./reps/%s_sav.rep", levelName); // For local
MarioResult r2 = game.playGame(getLevel(levelPath), repPath); // MarioResult r2 = game.playGame(getLevel(levelPath), repPath);
// MarioResult tmpResult = game.playGame(Replay.getRepAgentFromFile(repPath),getLevel(levelPath), 200, repPath); // MarioResult tmpResult = game.playGame(Replay.getRepAgentFromFile(repPath),getLevel(levelPath), 200, repPath);
// MarioGame game2 = new MarioGame(); // MarioGame game2 = new MarioGame();
@ -52,7 +52,7 @@ public class Play {
return playGameMain(groupID, levelName, 0); return playGameMain(groupID, levelName, 0);
} }
public static void replayGameMain(String groupID, String levelName){ public static void replayGameMain(String groupID, String levelName, int lives){
String levelPath = String.format("/app/levels/%s.lvl", levelName); // For web String levelPath = String.format("/app/levels/%s.lvl", levelName); // For web
String repPath = String.format("/files/%s_sav.rep", levelName); // For web String repPath = String.format("/files/%s_sav.rep", levelName); // For web
@ -60,6 +60,7 @@ public class Play {
// String repPath = String.format("./files/%s_sav.rep", levelName); // For local // String repPath = String.format("./files/%s_sav.rep", levelName); // For local
MarioGame game = new MarioGame(); MarioGame game = new MarioGame();
game.setLives(lives);
game.playGame(Replay.getRepAgentFromFile(repPath),getLevel(levelPath), 200, repPath); game.playGame(Replay.getRepAgentFromFile(repPath),getLevel(levelPath), 200, repPath);
} }
} }

View File

@ -43,8 +43,8 @@ public class Assets {
private static Image getImage(GraphicsConfiguration gc, String imageName) throws IOException { private static Image getImage(GraphicsConfiguration gc, String imageName) throws IOException {
//FIXME web/local //FIXME web/local
File file = new File(System.getProperty("user.dir") + "/img/" + imageName); // Local test //File file = new File(System.getProperty("user.dir") + "/img/" + imageName); // Local test
// File file = new File("/app/img/" + imageName); // For web File file = new File("/app/img/" + imageName); // For web
BufferedImage source = ImageIO.read(file); BufferedImage source = ImageIO.read(file);
Image image = gc.createCompatibleImage(source.getWidth(), source.getHeight(), Transparency.BITMASK); Image image = gc.createCompatibleImage(source.getWidth(), source.getHeight(), Transparency.BITMASK);
Graphics2D g = (Graphics2D) image.getGraphics(); Graphics2D g = (Graphics2D) image.getGraphics();

View File

@ -4,3 +4,4 @@
127.0.0.1,a,b,A 127.0.0.1,a,b,A
127.0.0.1,168,15,N 127.0.0.1,168,15,N
127.0.0.1,19,50,A 127.0.0.1,19,50,A
127.0.0.1,68,83,N

1 127.0.0.1 a b anno
4 127.0.0.1 a b A
5 127.0.0.1 168 15 N
6 127.0.0.1 19 50 A
7 127.0.0.1 68 83 N

View File

@ -22,3 +22,4 @@ IP,Style,Frequency,Age,Gender
127.0.0.1,C,E,A,B, 127.0.0.1,C,E,A,B,
127.0.0.1,B,A,D,A, 127.0.0.1,B,A,D,A,
127.0.0.1,A,A,A,B, 127.0.0.1,A,A,A,B,
127.0.0.1,A,A,F,A,

1 IP,Style,Frequency,Age,Gender
22 127.0.0.1,C,E,A,B,
23 127.0.0.1,B,A,D,A,
24 127.0.0.1,A,A,A,B,
25 127.0.0.1,A,A,F,A,

View File

@ -0,0 +1 @@
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '18', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '18', '18', '18', '18', '18', '18', '18', '18', '18', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '17', '17', '17', '17', '17', '17', '17', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '17', '17', '17', '17', '17', '17', '17', '17', '17', '17', '17', '17', '17', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2']

File diff suppressed because one or more lines are too long

View File

@ -203,12 +203,12 @@ function Replay(id){
console.log("{{level1}}") console.log("{{level1}}")
var replayWindow=document.getElementById("replayWindow"); var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible'; replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", "{{level1}}", "{{level1}}"); cjCall("Play", "replayGameMain", "{{level1}}", "{{level1}}",5);
}else if(id==2){ }else if(id==2){
console.log("{{level2}}") console.log("{{level2}}")
var replayWindow=document.getElementById("replayWindow"); var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible'; replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", "{{level2}}", "{{level2}}"); cjCall("Play", "replayGameMain", "{{level2}}", "{{level2}}",5);
}else{ }else{
} }

View File

@ -30,7 +30,7 @@ function PostToServer(url,data) {
} }
} }
function PlayLevel(group, level){ function PlayLevel(group, level){
var returnVal = cjCall("Play", "playGameMain", group, level); var returnVal = cjCall("Play", "playGameMain", group, level,5);
return returnVal.then(function(){ return returnVal.then(function(){
console.log("the return val is ready"); console.log("the return val is ready");
console.log(returnVal.value); console.log(returnVal.value);