{"id":67649,"student_id":10,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n\\t\u003cscript src=\\\"https://code.jquery.com/jquery-3.4.1.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003cp id=\\\"players\\\"\u003e\u003c/p\u003e\\n \u003cp id=\\\"logs\\\"\u003e\u003c/p\u003e\\n \u003cbutton id=\\\"move_btn\\\"\u003e一顆骰子\u003c/button\u003e\\n \u003cbutton id=\\\"buy_btn\\\"\u003e買入\u003c/button\u003e\\n \u003cbutton id=\\\"levelup_btn\\\"\u003e蓋房子\u003c/button\u003e\\n \u003cbutton\u003e下一位\u003c/button\u003e\\n \u003ctable\u003e\u003c/table\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"body {\\n text-align: center;\\n}\\n\\ntable {\\n border-collapse: collapse;\\n}\\n\\ntr, td {\\n padding: 5px;\\n border: 1px solid black;\\n}\\n\\ntd {\\n width: 100px;\\n}\",\"js\":\"setInterval(function () {\\n updateTable();\\n updatePlayer();\\n}, 1000);\\n\\n\\nfunction updateTable () {\\n $('table').html('');\\n map.forEach(function (d, idx) {\\n var html = `\\n \u003ctr\u003e\\n \u003ctd\u003e${idx}\u003c/td\u003e\\n \u003ctd\u003e \u003c/td\u003e\\n \u003ctd\u003e${d.name}\u003c/td\u003e\\n \u003ctd\u003e${d.price || ''}\u003c/td\u003e\\n \u003ctd\u003e${d.owner || '無'}\u003c/td\u003e\\n \u003ctd\u003e${d.type}\u003c/td\u003e\\n \u003c/tr\u003e\\n `\\n $('table').append(html);\\n });\\n}\\n\\nfunction updatePlayer () {\\n $('p').text('');\\n for (name in players) {\\n p = players[name];\\n var html = `\\n \u003cspan\u003e${name} 財富:${p.save}\u003c/span\u003e\\n \u003cbr/\u003e\\n `\\n $('#players').append(html);\\n $($('table tr td')[p.position*6]).append(`\u003cspan\u003e${name}\u003c/span\u003e`)\\n }\\n}\\n\\nfunction message (msg) {\\n $('#logs').append(`\u003cspan\u003e${msg}\u003c/span\u003e\u003cbr/\u003e`);\\n}\\n\\n\\n$('#move_btn').click(function () {\\n var idx = Math.ceil(Math.random()*6);\\n players[name].position += idx;\\n if (players[name].position \u003e 11) players[name].position -= 11;\\n \\n if (map[player.position].name == '魔法占卜屋') {\\n fate();\\n }\\n if (map[player.position].name == '道具店') {\\n shop();\\n }\\n \\n var owner = map[player.position].owner;\\n if (owner != undefined) {\\n player.save -= map[player.position].toll;\\n players[owner].save += map[player.position].toll;\\n }\\n});\\n\\nfunction fate () {\\n var rand = Math.random()*100;\\n if (rand \u003c 10) {\\n message('被查稅! 扣除 500');\\n players[name].save -= 500;\\n } else if (rand \u003c 20) {\\n \\n } else if (rand \u003c 20) {\\n \\n }\\n}\\n\\n\\n$('#buy_btn').click(function () {\\n var player = players[name];\\n if (map[player.position].owner == undefined) {\\n if (map[player.position].price \u003c player.save) {\\n player.save -= map[player.position].price;\\n map[player.position].owner = player.name;\\n message(name + '購買了' + map[player.position].name);\\n } else {\\n alert('身上的現金不夠!');\\n }\\n } else {\\n alert('已經有地主了!');\\n }\\n});\\n\\n$('#levelup_btn').click(function () {\\n // var pos = player.position;\\n // if (map[pos].level \u003c 5) {\\n // map[pos].level++;\\n // // player[name].save -= 100;\\n // } else if (map[pos].level == 5) {\\n // // map[pos].level++;\\n // } else {\\n // alert('已經升到最頂級');\\n // }\\n});\"}","created_at":"2019-05-13T17:58:48.162+08:00","updated_at":"2019-11-08T12:38:26.260+08:00","name":"大富翁","language":"web","screenshot":{"url":"/uploads/project/screenshot/67649/f07c2446165c7dc7b40be6bcfa40dc14.jpg"},"parent_id":3,"plugin":"var name = '金夫人';\nvar players = {}\nplayers[name] = {\n name: name,\n position: 0,\n save: 10000,\n tool: [],\n}\n\nvar map = [{\n name: '道具店',\n},\n {\n name: '銀行',\n },\n {\n name: '羅斯福路一段',\n price: 2000,\n toll: 500,\n level: 0,\n type: '空地',\n },\n {\n name: '羅斯福路二段',\n price: 3000,\n toll: 700,\n level: 0,\n type: '空地',\n },\n {\n name: '羅斯福路三段',\n price: 4000,\n toll: 800,\n level: 0,\n type: '空地',\n },\n {\n name: '羅斯福路四段',\n price: 5000,\n toll: 1000,\n level: 0,\n type: '空地',\n },\n {\n name: '銀行',\n },\n {\n name: '魔法占卜屋',\n },\n {\n name: '信義路一段',\n price: 5000,\n toll: 1000,\n level: 0,\n type: '空地',\n },\n {\n name: '信義路二段',\n price: 5000,\n toll: 1000,\n level: 0,\n type: '空地',\n },\n {\n name: '監獄',\n },\n {\n name: '和平東路路一段',\n price: 5000,\n toll: 1000,\n level: 0,\n type: '空地',\n },\n {\n name: '和平東路路二段',\n price: 5000,\n toll: 1000,\n level: 0,\n type: '空地',\n },\n {\n name: '醫院',\n },\n]","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":524,"hashid":"ej9sw8kk","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
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