微語成謎-猜成語Codeidiom
成語
.
<!DOCTYPE html>
<html lang="zh-Hant">
<head>
<meta charset="UTF-8">
<title>隨機抽成語</title>
<!-- 引入 Roboto 粗體 -->
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap" rel="stylesheet">
<style>
.container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 50px;
}
/* star 方形圓角按鈕 */
#startButton {
background-color: #c7dbe2;
color: #0f4e77;
font-family: 'Roboto', sans-serif;
border: none;
border-radius: 8px;
width: 160px;
height: 140px;
font-size: 60px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
#startButton:disabled {
background-color: #c7dbe2;
cursor: not-allowed;
}
/* 黑色圓圈 */
.circle {
background-color: #0f4e77;
color: #c7dbe2;
font-family: 'Roboto', sans-serif;
font-weight: 700;
font-size: 60px;
width: 140px;
height: 140px;
border-radius: 50%;
margin-left: 10px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div class="container">
<button id="startButton">star</button>
<div class="circle" id="circle1"></div>
<div class="circle" id="circle2"></div>
<div class="circle" id="circle3"></div>
<div class="circle" id="circle4"></div>
</div>
<script>
// 100 個帶數字的四字成語
const idioms = [
'一石二鳥','三心二意','五湖四海','六神無主','七上八下','八仙過海','九牛一毛','十全十美',
'丞喆好帥','千方百計','一心一意','一舉兩得','三長兩短','七情六欲','三三兩兩','四通八達','五光十色','六親不認',
'千鈞一髮','九死一生','千山萬水','一清二白','百折不撓','百年好合','百無一失',
'一鳴驚人','一觸即發','二話不說','三言兩語','三頭六臂','四面八方','五體投地','七手八腳',
'三生有幸','五彩繽紛','一馬當先','四分五裂','四平八穩','八面玲瓏','七嘴八舌','千軍萬馬',
'九霄雲外','千篇一律','十拿九穩','千變萬化','萬紫千紅','百鬼夜行','四腳朝天',
'一波三折','六根清淨','三令五申','百戰百勝','兩全其美','五花八門',
'兩小無猜','五福臨門','十指連心','三跪九叩','六六大順','千里迢迢','一鼓作氣','四海一家',
'一視同仁','五味俱全','三五成群','千嬌百媚','三思而行','兩敗俱傷','一舉成名',
'七零八落','一成不變','百花齊放','一網打盡'
];
const button = document.getElementById('startButton');
const circles = [
document.getElementById('circle1'),
document.getElementById('circle2'),
document.getElementById('circle3'),
document.getElementById('circle4')
];
button.addEventListener('click', () => {
button.disabled = true;
let timeLeft = 5;
// 初始化倒數,5 個圖形都顯示數字
button.textContent = timeLeft;
circles.forEach(c => c.textContent = timeLeft);
const timer = setInterval(() => {
timeLeft--;
if (timeLeft > 0) {
button.textContent = timeLeft;
circles.forEach(c => c.textContent = timeLeft);
} else {
clearInterval(timer);
// 隨機選取成語並拆字
const idx = Math.floor(Math.random() * idioms.length);
const chars = idioms[idx].split('');
circles.forEach((c, i) => c.textContent = chars[i]);
// 恢復按鈕文字及狀態
button.textContent = 'star';
button.disabled = false;
}
}, 1000);
});
</script>
</body>
</html>
微語成謎 swift 程式體驗:教學資源
Block-Based Coding vs Text Coding for Kids
五年級透過Scratch透過拖曳圖形模塊建立程式
文字式編程語言能提供了更多的靈活性和功能
教師需如何構建一個合理的下一步?
Firmware 固件
You may need to update the firmware on your micro:bit to use features like WebUSB
你需要更新microbit上的Firmware(固件)才能使用WebUSB功能
Swift Playgrounds is an app for iPad and Mac computers that helps teach people to code in the Swift language using interactive 'books'. We've created a book that interacts with the micro:bit wirelessly, helping you to learn the fundamentals of code while having fun with your micro:bit.
Swift Playgrounds 是一款適用於 iPad 和 Mac 電腦的應用程式,可幫助人們使用互動式“書籍”教人們使用 Swift 語言進行編碼。BBC 製作了一本與 micro:bit 無線交互的書,透過 micro:bit 學習代碼的基礎知識。
通過訂閱 URL來添加“BBC micro:bit”Swift Playground 書籍 feed.json
藍牙控制 hex 檔:Download the latest Bluetooth control hex file