{"id":247415,"student_id":10,"content":"{\"html\":\"\",\"css\":\"\",\"js\":\"let numberRange = 5; //水果單張卡片最大數量\\nlet targetNumber = 5; //搶牌時要達成的數量\\n\\nlet count = 0;\\n\\nlet cards = [];\\n\\nfunction reset () {\\n cards = [\\n { type: 0, number: 0 },\\n { type: 0, number: 0 },\\n { type: 0, number: 0 },\\n { type: 0, number: 0 },\\n ]\\n count = 0;\\n}\\n\\n\\nfunction next () {\\n let idx = count % 4;\\n cards[idx].type = Math.floor(Math.random() * 4) + 1;\\n cards[idx].number = Math.floor(Math.random() * numberRange) + 1;\\n count++;\\n}\\n\\n\\nfunction check () {\\n let arr = [0, 0, 0, 0, 0];\\n \\n cards.forEach(card =\u003e {\\n arr[card.type] += card.number;\\n })\\n \\n return arr.some(number =\u003e number == targetNumber)\\n}\\n\\nfunction avg (arr) {\\n var sum = 0;\\n for (let i = 0 ; i \u003c arr.length; i++) sum += arr[i];\\n return sum / arr.length;\\n}\\n\\n\\nfunction exp (a, b) {\\n logs = [];\\n \\n numberRange = a;\\n targetNumber = b;\\n \\n for (let i = 0; i \u003c 1000; i++) {\\n reset();\\n while(!check() \u0026\u0026 count \u003c 100) next();\\n logs.push(count);\\n }\\n \\n console.log(`numberRange:${numberRange}, targetNumber${targetNumber}`);\\n console.log(avg(logs));\\n}\\n\\n\\nexp(5, 6);\\nexp(5, 5);\\nexp(5, 4);\\n\\nexp(4, 6);\\nexp(4, 5);\\nexp(4, 4);\\n\\n\"}","created_at":"2021-04-26T12:04:30.303+08:00","updated_at":"2021-04-26T12:33:47.109+08:00","name":"test","language":"web","screenshot":{"url":"/uploads/project/screenshot/247415/ea159e1ebc6641f30f0f94adbc21cd53.jpg"},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":382,"hashid":"2pds9v62j","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4630173,"file_name":"koding.png","project_id":247415,"asset_id":302342,"created_at":"2021-04-26T12:04:30.308+08:00","updated_at":"2021-04-26T12:04:30.308+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
Open Web Site
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer