qq_婉轉_0
2018-05-24 22:28
// 旋转 Square.prototype.canRotate = function (isValid) { let d = (this.dire + 1) % 4; let test = [ [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0] ]; for (let i = 0; i < this.data.length; i++) { for (let j = 0; j < this.data[0].length; j++) { test[i][j] = this.rotates[d][i][j]; } } return isValid(this.origin, test); }; Square.prototype._rotate = function (num) { if (!num) { num = 1; } this.dir = (this.dir + num) % 4; this.dire += 1; for (let i = 0; i < this.data.length; i++) { for (let j = 0; j < this.data[0].length; j++) { this.data[i][j] = this.rotates[this.dire][i][j]; } } };
已经解决
基于websocket的火拼俄罗斯(单机版)
31676 学习 · 106 问题
相似问题