Add Annotation
This commit is contained in:
parent
0007a64a37
commit
49ca55bfb5
16
.idea/workspace.xml
generated
16
.idea/workspace.xml
generated
@ -2,16 +2,27 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/pyExcel.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/reps/1.txt" beforeDir="false" afterPath="$PROJECT_DIR$/reps/1.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/reps/2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/reps/2.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GameAnnotation.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameAnnotation.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/GamePlay.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GamePlay.html" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
@ -90,7 +101,8 @@
|
||||
<workItem from="1666340478319" duration="84000" />
|
||||
<workItem from="1666700018091" duration="3635000" />
|
||||
<workItem from="1666752468427" duration="1563000" />
|
||||
<workItem from="1667205217155" duration="1543000" />
|
||||
<workItem from="1667205217155" duration="3357000" />
|
||||
<workItem from="1667357110859" duration="5735000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -109,6 +121,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1667206170033" 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="1667362305523" 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.
Binary file not shown.
23
main.py
23
main.py
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
from flask import Flask, render_template, request, redirect, url_for
|
||||
|
||||
@ -7,18 +8,17 @@ app = Flask(__name__, static_folder='')
|
||||
replayDataPath = "reps/"
|
||||
evalDataPath = "evals/"
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
py2htmlstr = 'py2html test str'
|
||||
return render_template('GamePlay.html', py2htmlstr=py2htmlstr)
|
||||
@app.route('/gameplay')
|
||||
def gameplay():
|
||||
return render_template('GamePlay.html')
|
||||
|
||||
|
||||
@app.route('/eval')
|
||||
def eval():
|
||||
return render_template('eval.html')
|
||||
@app.route('/gameanno')
|
||||
def gameanno():
|
||||
return render_template('GameAnnotation.html')
|
||||
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
@app.route('/gameplay', methods=['POST'])
|
||||
def getJSONData():
|
||||
if request.method == 'POST':
|
||||
print("POST Game")
|
||||
@ -26,12 +26,13 @@ def getJSONData():
|
||||
saveFile(replayDataPath, request.json[4], request.json)
|
||||
return "Catch JSON Data"
|
||||
|
||||
@app.route('/eval', methods=['POST'])
|
||||
@app.route('/gameanno', methods=['POST'])
|
||||
def getRadioData():
|
||||
if request.method == 'POST':
|
||||
print("POST Eval")
|
||||
print(request.json)
|
||||
saveFile(evalDataPath,"eval",request.json[0]+request.json[1]+request.json[2])
|
||||
print(request.values)
|
||||
|
||||
#saveFile(evalDataPath,"gameanno",request.json[0]+request.json[1]+request.json[2])
|
||||
return "catch Radio"
|
||||
|
||||
def saveFile(path,filename,content):
|
||||
|
121
pyExcel.py
Normal file
121
pyExcel.py
Normal file
@ -0,0 +1,121 @@
|
||||
"""
|
||||
基于openpyxl的excel读写模块
|
||||
提供更简单的读写方式
|
||||
"""
|
||||
from openpyxl import load_workbook, Workbook
|
||||
|
||||
|
||||
class ExcelWork:
|
||||
|
||||
def __init__(self, filePath):
|
||||
"""
|
||||
初始化, 加载excel,默认选择第一个工作表
|
||||
:param filePath: str: 文件地址
|
||||
"""
|
||||
self.filePath = filePath
|
||||
try:
|
||||
# 加载excel
|
||||
self.excel = load_workbook(self.filePath)
|
||||
except FileNotFoundError:
|
||||
# 创建excel
|
||||
self.excel = Workbook(self.filePath)
|
||||
# 创建sheet
|
||||
self.createSheet('Sheet1')
|
||||
# 保存excel
|
||||
self.close()
|
||||
# 加载excel
|
||||
self.excel = load_workbook(self.filePath)
|
||||
# sheet设置为第一个工作表
|
||||
self.sheet = self.excel.active
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
保存并退出
|
||||
:return:
|
||||
"""
|
||||
self.excel.save(self.filePath)
|
||||
|
||||
def createSheet(self, sheetName):
|
||||
"""
|
||||
创建工作表
|
||||
:param sheetName: str: 工作表名
|
||||
:return:
|
||||
"""
|
||||
self.excel.create_sheet(sheetName)
|
||||
|
||||
def getSheetTitle(self):
|
||||
"""
|
||||
获取当前工作表名称
|
||||
:return: str: 工作表名称
|
||||
"""
|
||||
return self.sheet.title
|
||||
|
||||
def getSheetTitles(self):
|
||||
"""
|
||||
获取excel所有工作表的名称
|
||||
:return: list: [工作表名称,]
|
||||
"""
|
||||
return self.excel.sheetnames
|
||||
|
||||
def delSheet(self):
|
||||
"""
|
||||
删除当前工作表
|
||||
:return:
|
||||
"""
|
||||
self.excel.remove(self.sheet)
|
||||
|
||||
def selectSheet(self, sheetName):
|
||||
"""
|
||||
选择工作表, 如果没有将创建
|
||||
:param sheetName: str: 工作表名
|
||||
:return:
|
||||
"""
|
||||
if sheetName in self.getSheetTitles():
|
||||
# 选择工作表
|
||||
self.sheet = self.excel[sheetName]
|
||||
else:
|
||||
# 创建工作表
|
||||
self.createSheet(sheetName)
|
||||
# 选择工作表
|
||||
self.sheet = self.excel[sheetName]
|
||||
|
||||
def setCell(self, r, c, var):
|
||||
"""
|
||||
修改指定行, 列的单元格内容
|
||||
:param r: int: 行数
|
||||
:param c: int: 列数
|
||||
:param var: str: 修改内容
|
||||
:return:
|
||||
"""
|
||||
self.sheet.cell(row=r, column=c, value=var)
|
||||
|
||||
def getCell(self, r, c):
|
||||
"""
|
||||
获取指定行, 列的单元格内容
|
||||
:param r: int: 行数
|
||||
:param c: int: 列数
|
||||
:return: str: 单元格内容
|
||||
"""
|
||||
return self.sheet.cell(row=r, column=c).value
|
||||
|
||||
def getRow(self, r):
|
||||
"""
|
||||
获取指定行所有数据
|
||||
:param r: int: 行数
|
||||
:return: list: [数据,]
|
||||
"""
|
||||
rowList = []
|
||||
for cell in self.sheet[r]:
|
||||
rowList.append(cell.value)
|
||||
return rowList
|
||||
|
||||
def getColumn(self, c):
|
||||
"""
|
||||
获取指定列所有数据
|
||||
:param c: int: 列数
|
||||
:return: list: [数据,]
|
||||
"""
|
||||
columnList = []
|
||||
for temp in range(1, self.sheet.max_row + 1):
|
||||
columnList.append(self.getCell(temp, c))
|
||||
return columnList
|
@ -1 +1 @@
|
||||
test1,66,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,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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,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,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,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,2,2,2,2,2
|
||||
test1
|
@ -1 +1 @@
|
||||
test2,66,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,18,18,18,18,18,18,18,18,18,18,2,2,2,2,2,2,18,18,18,18,18,18,18,18,18,18,18,18,18,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,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,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0
|
||||
test2
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
<!-- saved from url=(0029)http://aingames.cn/index.html -->
|
||||
<html lang="en"><script id="allow-copy_script">(function t(){var t=!1;document.addEventListener("allow_copy",(function(n){t=n.detail.unlock}));var n=["copy","cut","contextmenu","selectstart","mousedown","mouseup","mousemove","keydown","keypress","keyup"],e=function(n){t&&(n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation())};n.forEach((function(t){document.documentElement.addEventListener(t,e,{capture:!0})}))})()</script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<script src="https://cjrtnc.leaningtech.com/2.3/loader.js"></script>
|
||||
<script>
|
||||
<!-- <script>
|
||||
//The Funtions
|
||||
function PlayLevel(group, level){
|
||||
var returnVal = cjCall("Play", "playGameMain", group, level);
|
||||
@ -33,8 +33,8 @@
|
||||
}
|
||||
httpRequest.send(JSON.stringify(level+","+Array.from(data))); //设置为发送给服务器数据
|
||||
}
|
||||
</script>
|
||||
|
||||
</script> -->
|
||||
<script src="../templates/data.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
293
templates/GameQuestion.html
Normal file
293
templates/GameQuestion.html
Normal file
File diff suppressed because one or more lines are too long
97
templates/Web/radio.css
Normal file
97
templates/Web/radio.css
Normal file
@ -0,0 +1,97 @@
|
||||
$radioSize: 22px;
|
||||
$radioBorder: #D1D7E3;
|
||||
$radioActive: #5D9BFB;
|
||||
|
||||
.radio {
|
||||
margin: 16px 0;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
input {
|
||||
display: none;
|
||||
& + span {
|
||||
line-height: $radioSize;
|
||||
height: $radioSize;
|
||||
padding-left: $radioSize;
|
||||
display: block;
|
||||
position: relative;
|
||||
&:not(:empty) {
|
||||
padding-left: $radioSize + 8;
|
||||
}
|
||||
&:before,
|
||||
&:after {
|
||||
content: '';
|
||||
width: $radioSize;
|
||||
height: $radioSize;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
&:before {
|
||||
background: $radioBorder;
|
||||
transition: background .2s ease, transform .4s cubic-bezier(.175, .885, .32, 2);
|
||||
}
|
||||
&:after {
|
||||
background: #fff;
|
||||
transform: scale(.78);
|
||||
transition: transform .6s cubic-bezier(.175, .885, .32, 1.4);
|
||||
}
|
||||
}
|
||||
&:checked + span {
|
||||
&:before {
|
||||
transform: scale(1.04);
|
||||
background: $radioActive;
|
||||
}
|
||||
&:after {
|
||||
transform: scale(.4);
|
||||
transition: transform .3s ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
input {
|
||||
& + span {
|
||||
&:before {
|
||||
transform: scale(.92);
|
||||
}
|
||||
&:after {
|
||||
transform: scale(.74);
|
||||
}
|
||||
}
|
||||
&:checked + span {
|
||||
&:after {
|
||||
transform: scale(.4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Center & twitter
|
||||
body {
|
||||
min-height: 100vh;
|
||||
font-family: Roboto, Arial;
|
||||
color: #ADAFB6;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.twitter {
|
||||
position: fixed;
|
||||
display: block;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
opacity: .5;
|
||||
color: #212533;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: all .4s ease;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
img {
|
||||
display: block;
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
}
|
BIN
templates/Web/test1.png
Normal file
BIN
templates/Web/test1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
templates/Web/test2.png
Normal file
BIN
templates/Web/test2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
61
templates/data.js
Normal file
61
templates/data.js
Normal file
@ -0,0 +1,61 @@
|
||||
function closeReplayWindow(){
|
||||
var replayWindow=document.getElementById("replayWindow");
|
||||
replayWindow.style.visibility = 'hidden';
|
||||
}
|
||||
function Replay(id){
|
||||
var replayWindow=document.getElementById("replayWindow");
|
||||
replayWindow.style.visibility = 'visible';
|
||||
cjCall("Play", "replayGameMain", id, id);
|
||||
}
|
||||
function getValue(){
|
||||
var radio = document.getElementsByName("gameRadio");
|
||||
for (i=0; i<radio.length; i++) {
|
||||
if (radio[i].checked) {
|
||||
alert(radio[i].value)
|
||||
}
|
||||
}
|
||||
}
|
||||
// function PostToServer(data) {
|
||||
// var httpRequest = new XMLHttpRequest();//第一步:建立所需的对象
|
||||
// httpRequest.open("POST",""); //调用AddDataToServer
|
||||
// httpRequest.setRequestHeader("Content-Type", "application/json"); //设置请求头信息
|
||||
// httpRequest.onreadystatechange = function () {
|
||||
// if (httpRequest.readyState == 4 && httpRequest.status == 200) {
|
||||
// //alert('添加成功');
|
||||
// }
|
||||
// }
|
||||
// httpRequest.send(JSON.stringify(data)); //设置为发送给服务器数据
|
||||
// }
|
||||
function PostToServer(data) {
|
||||
$.post(window.location.href, {'key1':'5'});
|
||||
}
|
||||
function PlayLevel(group, level){
|
||||
var returnVal = cjCall("Play", "playGameMain", group, level);
|
||||
return returnVal.then(function(){
|
||||
console.log("the return val is ready");
|
||||
console.log(returnVal.value);
|
||||
PostToServer(level,returnVal.value);
|
||||
});
|
||||
}
|
||||
|
||||
function GameOver(){
|
||||
if(alert("Game Over!")){
|
||||
|
||||
}
|
||||
}
|
||||
function getRadioValue(){
|
||||
alert("getvalue");
|
||||
var obj = document.getElementsByName("fun");
|
||||
var result = " ";
|
||||
for(var i=0; i<obj.length; i ++){
|
||||
if(obj[i].checked){
|
||||
PostToServer(obj[i].value);
|
||||
result = obj[i].value;
|
||||
alert(obj[i].value);
|
||||
}
|
||||
}
|
||||
// var radio = document.getElementsByName("gameRadio");
|
||||
// var addressID = $("input[name='sex']:checked").val();
|
||||
// alert(addressID)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user