重要行为准则,切勿遗忘
- 诚实是第一要务,禁止私自杜撰与联想
- 杜绝奉承迎合,发现用户错误或不合理决策及时提出
- 明确说出你的假设,不确定/有疑惑就停下来问用户
- 存在多种理解时,列出选项,不要私自做选择
| -- @author: yangfch3 | |
| -- @date: 2020/09/27 15:20 | |
| ------------------------------------------ | |
| -- Node 基类 | |
| local DTNode = BaseClass("DTNode") | |
| function DTNode:ctor() end | |
| function DTNode:Eval(decisionTree, context) end | |
| function DTNode:SetChildren() | |
| assert(false) |
| --[[ | |
| A simple HTTP server | |
| If a request is not a HEAD method, then reply with "Hello world!" | |
| Usage: lua examples/server_hello.lua [<port>] | |
| ]] | |
| local MyLog = require "AIServer/MyLog" | |
| local http_server = require "http.server" | |
| local http_headers = require "http.headers" | |
| local json = require "3rds/json" |
| from argparse import Namespace | |
| import traceback | |
| import json | |
| import urllib | |
| import simp_http_serv_helper as helper | |
| from http.server import HTTPServer, BaseHTTPRequestHandler | |
| import json | |
| import os | |
| import sys | |
| import time | |
| import base64 | |
| from subprocess import DEVNULL, STDOUT, Popen, PIPE | |
| import merge_data | |
| conf_file = "run.conf.json" |
| function BaseClass(classname, super) | |
| local cls | |
| if super then | |
| cls = {} | |
| setmetatable(cls, {__index = super}) | |
| cls.super = super | |
| else | |
| cls = {ctor = function() end} | |
| end |
| local MathUtil = {} | |
| ---获取两点的距离 | |
| function MathUtil.GetDis(vec1, vec2) | |
| local x1 = vec1.x or vec1[1] | |
| local y1 = vec1.y or vec1[2] | |
| local x2 = vec2.x or vec2[1] | |
| local y2 = vec2.y or vec2[2] | |
| local disX = x1 - x2 |
| module.exports = { | |
| env: { | |
| browser: true, | |
| commonjs: true, | |
| es6: true, | |
| node: true, | |
| }, | |
| extends: ['eslint:recommended'], | |
| globals: { | |
| Atomics: 'readonly', |
| class Layer extends egret.Sprite { | |
| private mountTo: egret.DisplayObjectContainer | |
| constructor(mountTo: LayersDisplayObjectContainer) { | |
| super() | |
| // Layer 挂载到的 UI | |
| this.mountTo = mountTo | |
| } | |
| } |
| // 对一个对象的方法做缓存 | |
| function Memoize(func, obj) { | |
| obj = obj || window | |
| func = obj[func] | |
| let cache = {} | |
| return function () { | |
| let key = Array.prototype.join.call(arguments, '_') | |
| if (!(key in cache)) { | |
| // console.log('缓存未命中') | |
| cache[key] = func.apply(obj, arguments) |