吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 8322|回复: 128
上一主题 下一主题
收起左侧

[其他原创] deepseek辅助写的英语单词消消乐,可以用于英语课前互动

    [复制链接]
跳转到指定楼层
楼主
halou 发表于 2025-3-4 17:19 回帖奖励









[HTML] 纯文本查看 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>英语单词大作战</title>
    <style>
        .container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            padding: 20px;
            max-width: 1200px;
            margin: 0 auto;
        }
        .team-area {
            background: #f0f9ff;
            border: 3px solid #1890ff;
            border-radius: 15px;
            padding: 20px;
            min-height: 500px;
            position: relative;
        }
        #gameControl {
            text-align: center;
            margin: 20px;
        }
        #controlBtn {
            padding: 15px 40px;
            font-size: 24px;
            background: #ff4d4f;
            color: white;
            border-radius: 30px;
            border: none;
            cursor: pointer;
            transition: all 0.3s;
        }
        #timer {
            text-align: center;
            font-size: 32px;
            color: #fa541c;
            margin: 10px 0;
            font-weight: bold;
        }
        .chinese-prompt {
            text-align: center;
            font-size: 28px;
            color: #2f54eb;
            margin: 20px 0;
            font-weight: bold;
        }
        .word-btn {
            background: #fff;
            border: 2px solid #40a9ff;
            border-radius: 25px;
            padding: 12px 24px;
            margin: 8px;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .word-btn.correct {
            background: #73d13d !important;
            transform: scale(0.9);
        }
        .word-btn.wrong {
            background: #ff4d4f !important;
            opacity: 0.7;
        }
        .score {
            position: absolute;
            bottom: 20px;
            right: 20px;
            font-size: 24px;
            color: #1890ff;
        }
    </style>
</head>
<body>
    <div id="gameControl">
        <button id="controlBtn">游戏开始</button>
    </div>
    <div id="timer">剩余时间:3:00</div>
    
    <div style="text-align: center; padding: 20px;">
        <input type="file" id="wordFile" accept=".txt" 
               style="display: none;">
        <button
                style="padding: 12px 24px; background: #1890ff; color: white; border: none; border-radius: 5px; cursor: pointer;">
            上传单词表 (.txt)
        </button>
    </div>

    <div class="container">
        <div class="chinese-prompt">请选择:<span class="current-prompt"></span></div>
        <div class="chinese-prompt">请选择:<span class="current-prompt"></span></div>
        
        <div class="team-area" id="team1">
            <div class="score">得分: 0</div>
        </div>
        <div class="team-area" id="team2">
            <div class="score">得分: 0</div>
        </div>
    </div>

<script>
    let isPlaying = false;
    let currentWords = [];
    let currentPrompt = '';
    let gameTimer;
    let timeLeft = 180;

    function toggleGame() {
        const btn = document.getElementById('controlBtn');
        if (!isPlaying) {
            if (currentWords.length === 0) {
                alert('请先上传单词表!');
                return;
            }
            btn.textContent = '游戏中...';
            btn.style.background = '#52c41a';
            startTimer();
            startRound();
            isPlaying = true;
        } else {
            endGame();
        }
    }

    function loadWords(file) {
        const reader = new FileReader();
        reader.onload = function(e) {
            currentWords = e.target.result.split('\n')
                .filter(line => line.trim())
                .map(line => {
                    const [english, chinese] = line.split(',');
                    return { 
                        english: english.trim(), 
                        chinese: chinese.trim(),
                        used: false
                    };
                });
            setupGame();
        };
        reader.readAsText(file);
    }

    function setupGame() {
        document.querySelectorAll('.word-btn').forEach(btn => btn.remove());
        
        const createTeamWords = (container) => {
            const shuffled = [...currentWords].sort(() => Math.random() - 0.5);
            shuffled.forEach(word => {
                const btn = document.createElement('button');
                btn.className = 'word-btn';
                btn.textContent = word.english;
                btn.onclick = () => handleWordClick(word.english, word.chinese, btn);
                container.insertBefore(btn, container.querySelector('.score'));
            });
        };

        createTeamWords(document.getElementById('team1'));
        createTeamWords(document.getElementById('team2'));
    }

    function handleWordClick(english, chinese, btn) {
        if (!isPlaying) return;
        
        if (chinese === currentPrompt) {
            btn.classList.add('correct');
            const container = btn.closest('.team-area');
            const scoreElement = container.querySelector('.score');
            scoreElement.textContent = `得分: ${parseInt(scoreElement.textContent.match(/\d+/)) + 10}`;
            
            setTimeout(() => {
                btn.remove();
                startRound();
            }, 500);
        } else {
            btn.classList.add('wrong');
            setTimeout(() => btn.classList.remove('wrong'), 500);
        }
    }

    function startRound() {
        const availableWords = currentWords.filter(word => !word.used);
        if (availableWords.length === 0) {
            document.querySelectorAll('.current-prompt').forEach(span => {
                span.textContent = "所有单词已完成!";
            });
            return;
        }

        const randomIndex = Math.floor(Math.random() * availableWords.length);
        currentPrompt = availableWords[randomIndex].chinese;
        currentWords = currentWords.map(word => 
            word.chinese === currentPrompt ? {...word, used: true} : word
        );

        document.querySelectorAll('.current-prompt').forEach(span => {
            span.textContent = currentPrompt;
        });
    }

    function startTimer() {
        clearInterval(gameTimer);
        gameTimer = setInterval(() => {
            timeLeft--;
            const minutes = Math.floor(timeLeft / 60);
            const seconds = timeLeft % 60;
            document.getElementById('timer').textContent = 
                `剩余时间:${minutes}:${seconds.toString().padStart(2, '0')}`;
            
            if (timeLeft <= 0) endGame();
        }, 1000);
    }

    function endGame() {
        clearInterval(gameTimer);
        const btn = document.getElementById('controlBtn');
        btn.textContent = '游戏开始';
        btn.style.background = '#ff4d4f';
        isPlaying = false;
        
        // 显示当前得分后清零
        const score1 = document.querySelector('#team1 .score').textContent;
        const score2 = document.querySelector('#team2 .score').textContent;
        alert(`游戏结束!\n第一组得分:${score1}\n第二组得分:${score2}`);
        
        // 重置所有状态
        document.querySelectorAll('.score').forEach(span => span.textContent = '得分: 0');
        timeLeft = 180;
        document.getElementById('timer').textContent = '剩余时间:3:00';
        currentWords = currentWords.map(word => ({...word, used: false}));
        setupGame();
    }
</script>
</body>
</html>



小白一枚,如有违规,请版主删除!谢谢!

蓝奏云:https://freekejian.lanzout.com/iLSqv2pjz9hi



免费评分

参与人数 24吾爱币 +27 热心值 +21 收起 理由
wangdao + 1 + 1 谢谢@Thanks!
不二 + 3 + 1 谢谢@Thanks!
yyccyycc + 1 + 1 谢谢@Thanks!
Ayun513 + 1 + 1 我很赞同!
gjl187 + 1 + 1 我很赞同!
dynastymonster + 1 谢谢
Epsilonmizuho1 + 1 + 1 我很赞同!
Liuin + 1 + 1 谢谢@Thanks!
lisa116 + 1 + 1 谢谢@Thanks!
苏紫方璇 + 5 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
wangmin + 1 用心讨论,共获提升!
a1iyan + 1 我很赞同!
smhbhsg + 1 + 1 谢谢@Thanks!
kevinzou + 1 + 1 我很赞同!楼主能分享一下制作的提示词吗?谢谢
sjh198687 + 1 我很赞同!
pyjiujiu + 1 谢谢@Thanks!
Ageless2543 + 1 我很赞同!
lymanxin + 1 用心讨论,共获提升!
XMax + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
paohu + 1 热心回复!
smile1110 + 3 + 1 天才
zjerry + 1 + 1 我很赞同!
congcongzhidao + 1 + 1 我很赞同!
SherlockProel + 1 + 1 我很赞同!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
 楼主| halou 发表于 2025-3-5 21:38 |楼主
kevinzou 发表于 2025-3-5 18:09
楼主,用ds制作这个的提示词能分享一下吗?

请创建一个基于HTML、CSS和JavaScript的“英语单词大作战”小游戏,具体要求如下:

### 界面设计
1. **整体布局**:使用网格布局将页面分为两个团队区域,每个区域有一定的间距和样式。
2. **游戏控制按钮**:在页面顶部有一个按钮,初始显示“游戏开始”,点击后开始游戏,按钮变为“游戏中...”,游戏结束后恢复为“游戏开始”。按钮要有合适的样式,如背景颜色、字体大小等。
3. **计时器**:在游戏控制按钮下方显示一个倒计时计时器,初始时间为3分钟,格式为“剩余时间:3:00”,每秒更新一次。
4. **单词表上传**:提供一个上传按钮,点击后弹出文件选择框,允许用户上传包含英语单词和中文释义的TXT文件。文件格式为每行一个单词,英文和中文用逗号分隔。
5. **中文提示**:在团队区域上方显示当前的中文释义提示,字体大小和颜色要突出。
6. **单词按钮**:每个团队区域内显示多个英语单词按钮,按钮有一定的样式,点击后有相应的反馈效果。
7. **得分区域**:每个团队区域内有一个得分显示区域,初始得分都为0。

### 功能实现
1. **游戏控制**:点击“游戏开始”按钮前,检查是否已上传单词表,若未上传则弹出提示框。游戏开始后,启动计时器和新一轮游戏。点击“游戏中...”按钮可提前结束游戏。
2. **单词表加载**:读取用户上传的TXT文件,解析其中的单词和释义,并将其存储在一个数组中。
3. **计时功能**:游戏开始后,启动一个3分钟的倒计时计时器,每秒更新一次显示的剩余时间。时间结束后,自动结束游戏。
4. **单词选择**:游戏开始后,随机从单词数组中选择一个未使用过的单词,显示其中文释义作为提示。玩家点击单词按钮时,检查选择是否正确。
5. **计分系统**:若玩家选择正确,按钮变为绿色,该团队得分加10分,移除该按钮并开始下一轮游戏;若选择错误,按钮变为红色,一段时间后恢复原状。
6. **游戏结束处理**:游戏结束后,弹出对话框显示两个团队的得分,重置所有状态,包括得分、计时器和单词使用状态。

### 代码要求
1. **HTML**:使用合适的标签和结构来构建页面,确保界面布局清晰。
2. **CSS**:使用CSS样式来美化页面,包括按钮样式、背景颜色、字体大小等。
3. **JavaScript**:实现游戏的逻辑控制,包括游戏开始、计时、单词选择、计分等功能。代码要具有良好的可读性和可维护性。

-------------------------------------------------------------------------------------------------------------------
AI提示词并不是万能的,基本功能可以实现,因为它是通过推理得到的。通过制作这个小游戏,小白的我发现,根据一次次给出的结果,还是要反复的修改,并不一定一次可以100%的还原。关键在于你想要的功能和设计样式,多次尝试修改后,才能达到自己的想法。个人浅见,请大佬不吝赐教!
推荐
lf1988103 发表于 2025-3-4 17:24
3#
ourland 发表于 2025-3-4 17:33
4#
Jack-lee 发表于 2025-3-4 17:34
支持支持。。。
5#
sakylawa 发表于 2025-3-4 17:35
词库用的什么?
6#
xjshuaishuai 发表于 2025-3-4 17:42
很不错的小程序,谢谢分享!
7#
zoeroland 发表于 2025-3-4 17:44
看着不错哈,简单实用
8#
SherlockProel 发表于 2025-3-4 17:47
很优秀,搞下来玩玩
9#
fly6022 发表于 2025-3-4 17:50
感谢楼主分享
10#
饮食协会 发表于 2025-3-4 17:53
可以导入日语词库吗
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-11-8 11:03

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表