{"id":25983,"student_id":10,"content":"var W = 4;\nvar grid = [[],[],[],[]];\n\nfor (var i=0; i\u003c4; i++) {\n \n}\n\n\nfunction check (posA, posB) {\n if (posA.x == posB.x || posA.y == posB.y) return false;\n if (Math.abs(posA.x - posB.x) == Math.abs(posA.y - posB.y)) return false;\n return true;\n}\n\n// var q = 4;\n// var chess = [[],[],[],[]];\n// var cx = 0;\n// var cy = 0;\n// while (qc != q) {\n// for (var x = 0; x \u003c q; x++) {\n// for (var y = 0; y \u003c q; y++) {\n// chess[x][y] = 0;\n// }\n// }\n// var qc = 0;\n\n// for (var x = cx; x \u003c q; x++) {\n// for (var y = cy; y \u003c q; y++) {\n// if (chess[x][y] == 0) {\n// chess[x][y] = 1;\n// qc++;\n// console.log(\"queen\");\n// for (var i = 0; i \u003c q; i++) {\n// if (i != x \u0026\u0026 i != y) {\n// chess[x][i] = 2;\n// chess[i][y] = 2;\n// if (x - i \u003e= 0 \u0026\u0026 y - i \u003e= 0) chess[x - i][y - i] = 2;\n// if (x + i \u003c 4 \u0026\u0026 y - i \u003e= 0) chess[x + i][y - i] = 2;\n// if (x - i \u003e= 0 \u0026\u0026 y + i \u003c 4) chess[x - i][y + i] = 2;\n// if (x + i \u003c 4 \u0026\u0026 y + i \u003c 4) chess[x + i][y + i] = 2;\n// }\n// }\n// }\n// }\n// }\n// console.log(qc + \"failed\");\n// cx++;\n// if (cx \u003e= q) {\n// cx = 0;\n// cy++;\n// }\n// }\n\nfor(var i = 0 ; i \u003c 4; i++){\n for(var j = 0; j \u003c 4; j++){\n if((i + j) % 2 != 0){\n createSprite({\n x: i*120 + 140,\n y: j*120 + 60,\n scale: 2.0, // 2倍大\n costumes: [\"light.png\"]\n });\n }else{\n createSprite({\n x: i*120 + 140,\n y: j*120 + 60,\n scale: 2.0, // 2倍大\n costumes: [\"dark.png\"]\n });\n }\n if(chess[i][j] == 1){\n createSprite({\n x: i*120 + 140,\n y: j*120 + 60,\n scale: 2.0, // 2倍大\n costumes: [\"queen.png\"]\n });\n }\n } \n}","created_at":"2018-03-30T23:24:35.582+08:00","updated_at":"2019-11-03T01:40:32.970+08:00","name":"4皇后","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/25983/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":25981,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":308,"hashid":"882s4g6d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":481035,"file_name":"queen.png","project_id":25983,"asset_id":59493,"created_at":"2018-03-30T23:24:35.589+08:00","updated_at":"2018-03-30T23:24:35.589+08:00"},{"id":481036,"file_name":"light.png","project_id":25983,"asset_id":59492,"created_at":"2018-03-30T23:24:35.591+08:00","updated_at":"2018-03-30T23:24:35.591+08:00"},{"id":481037,"file_name":"dark.png","project_id":25983,"asset_id":59491,"created_at":"2018-03-30T23:24:35.592+08:00","updated_at":"2018-03-30T23:24:35.592+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦