我正在努力弄清楚如何为我正在开发的这款汽车游戏制作曲目。当前的问题是,当我绘制轨道时,绘图的坐标会相对于汽车的坐标进行转换。抱歉,这有点难以解释,但是如果您查看下面的代码,您就会明白我的意思。然后是使所有图纸都保留在最新框架上的问题,但这是另一天的问题。(请忽略汽车留下的痕迹,一旦我弄清楚如何确保在最新的框架上重新绘制图纸,就会修复。我真的对这个 JS 有点困惑,所以感谢任何和所有的帮助!
var MAX_VELOCITY = 3;
class Car {
constructor(x, y, angle) {
this.x = x;
this.y = y;
this.angle = angle;
this.velocity = 0;
this.accel = 0;
this.width = 40;
this.height = 80;
}
show() {
fill(255, 0, 255);
stroke(0);
translate(this.x, this.y);
rotate(this.angle);
rect(0, 0, this.width, this.height);
}
move() {
this.velocity += this.accel;
if (this.velocity > MAX_VELOCITY) {
this.velocity = MAX_VELOCITY;
}
if (this.velocity < -MAX_VELOCITY) {
this.velocity = -MAX_VELOCITY;
}
this.y += this.velocity * Math.sin(this.angle + Math.PI …Run Code Online (Sandbox Code Playgroud)我正在尝试设置 tensorflow 以在运行 Ubuntu 20.04 的 WSL 2 中使用 GPU 加速。我正在关注本教程,但遇到了这里看到的错误。但是,当我按照那里的解决方案尝试启动 docker 时,sudo service docker start我被告知 docker 是一个无法识别的服务。但是,考虑到我可以访问帮助菜单等,我知道 docker 已安装。虽然我可以让 docker 与桌面工具一起工作,但因为它不支持 Cuda,正如前面的 SO 帖子中提到的那样,它不是很有帮助。它并没有真正给我错误日志或任何东西,所以请询问您是否需要更多详细信息。
编辑:考虑到缺乏细节,以下是我尝试过但无济于事的解决方案列表。1 2 3
更新:我曾经sudo dockerd启动容器并尝试运行 nvidia 基准测试容器,但结果却是
INFO[2020-07-18T21:04:05.875283800-04:00] shim containerd-shim started address=/containerd-shim/021834ef5e5600bdf62a6a9e26dff7ffc1c76dd4ec9dadb9c1fcafb6c88b6e1b.sock debug=false pid=1960
INFO[2020-07-18T21:04:05.899420200-04:00] shim reaped id=70316df254d6b2633c743acb51a26ac2d0520f6f8e2f69b69c4e0624eaac1736
ERRO[2020-07-18T21:04:05.909710600-04:00] stream copy error: reading from a closed fifo
ERRO[2020-07-18T21:04:05.909753500-04:00] stream copy error: reading from a closed fifo
ERRO[2020-07-18T21:04:06.001006700-04:00] 70316df254d6b2633c743acb51a26ac2d0520f6f8e2f69b69c4e0624eaac1736 cleanup: failed to delete container from containerd: no …Run Code Online (Sandbox Code Playgroud)