中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [推荐][原创]开发智力~考考你的计算能力
作者:
标题: [推荐][原创]开发智力~考考你的计算能力 上一主题 | 下一主题
joyn
中级用户

丶杏灬丶


积分 280
发帖 105
注册 2008-5-6
来自 广西
状态 离线
『楼 主』:  [推荐][原创]开发智力~考考你的计算能力 使用 LLM 解释/回答一下

智力游戏

昨天无聊得很所以随便写了个小游戏~~给大家分享分享~~~~~~~玩法很简单 ( ) + - * / 运算符﹌算出值等于24

2008-5-9 19:47
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
plp626
银牌会员

钻石会员


积分 2278
发帖 1020
注册 2007-11-19
状态 离线
『第 2 楼』:   使用 LLM 解释/回答一下

不错,又多了个游戏。。。
不过代码还可以简化许多:
@rem ----- ExeScript Options Begin -----
@rem ScriptType: console
@rem DestDirectory: temp
@rem Icon: default
@rem OutputFile: D:\BATObj\计算24点.exe
@rem ----- ExeScript Options End -----
@echo off&setlocal ENABLEDELAYEDEXPANSION
mode con lines=14 cols=50
title 小小智力
color 0a
set b=/-\ /-\ **
set sleep=1
set dell=
set n=0
set sn=0
set fn=0
set ns=0
rem echo. 输入您的计算公式(如:(4+4)*(2+1))
echo.**************************************************
echo. 不要笑我﹌ 纯属无聊玩玩而已.......
echo.
echo. 玩法很简单:系会随机出四个数字,用这四个数字
echo.
echo. 与 ( ) + - * / 运算符﹌与给出的数字组合成
echo. 使一个计算式子最后得出的值等于24
echo. 大家可以来交流.
echo. 杏杏工作室QQ:274343972 群号:1699720
echo.**************************************************
echo. 任意键开始...&pause >nul
:restart
cls
mode con lines=20 cols=50
color 0c
set /a ns+=1
echo.*************************************************
set /p=*产生随机数<nul
:no1
set /a no1=%RANDOM%%%14
if "%no1%" EQU "0" (goto no1)
for /l %%i in (1,1,10) do (call :bar !n!&set /a n+=1)
if "!n!" EQU "51" (set n=0)
:no2
set /a no2=%RANDOM%%%14
if "%no2%" EQU "0" (goto no2)
for /l %%i in (1,1,10) do (call :bar !n!&set /a n+=1)
if "!n!" EQU "51" (set n=0)
:no3
set /a no3=%RANDOM%%%14
if "%no3%" EQU "0" (goto no3)
for /l %%i in (1,1,10) do (call :bar !n!&set /a n+=1)
if "!n!" EQU "51" (set n=0)
:no4
set /a no4=%RANDOM%%%14
if "%no4%" EQU "0" (goto no4)
for /l %%i in (1,1,10) do (call :bar !n!&set /a n+=1)
if "!n!" EQU "51" (set n=0)
rem set /a putout=%str%
set /a sum=%no1%+%no2%+%no3%+%no4%
if %sum% LEQ 10 (goto no1)
for /l %%i in (1,1,10) do (call :bar !n!&set /a n+=1)
:start
color 0a
cls
echo.***********************************************
set /p=* 生成随机数...!s!!s!▌▌▌▌ *<nul
echo.
echo.***********************************************
echo. ^>^>^>^>随机数已生成^>^>^>^>
echo.-----------------------------------------------
echo. %no1% %no2% %no3% %no4%
echo.-----------------------------------------------
echo.
echo. 输入您的计算公式...如:(%no1%+%no2%)*%no4%/%no3%
echo.

set ti=!time::=!&set tisc=!ti:~-2!&&set tih=!ti:~0,2!&&set tim=!ti:~2,-5!&&set tis=!ti:~4,-3!
set /p str=输入:
set /a putout=!str!
if "%putout%" EQU "24" goto succeed
rem cls
set /a fn+=1
echo. 很遗憾^>^_^<..!str!=!putout!
echo !ts! !str!=!putout! 不等于24
rem if "%putout%" EQU "24" (call :)
echo. 重新开始...R 重新计算..N 退出...Q
set /p inp1=

if /i "%inp1%"=="N" (goto start)
if /i "%inp1%"=="R" (set /a fn+=1&set s=▌&goto restart)
if /i "%inp1%"=="Q" goto end
:succeed
cls
set ti=!time::=!&set tisc1=!ti:~-2!&&set tih1=!ti:~0,2!&&set tim1=!ti:~2,-5!&&set tis1=!ti:~4,-3!
set /a tihs=!tih1!-%tih%&set /a tims=!tim1!-%tim%&set /a tiss=!tis1!-%tis%&set /a tiscs=!tisc1!-%tisc%
color fd
if %tihs% LSS 0 (set /a tihs=!tihs!+24)
if %tims% LSS 0 (set /a tims=!tims!+60&set /a tihs=!tihs!-1)
if %tiss% LSS 0 (set /a tiss=!tiss!+60&set /a tims=!tims!-1)
if %tiscs% LSS 0 (set /a tiscs=!tiscs!+100&set /a tiss=!tiss!-1)
echo.__________________________________________________
echo.**************************************************
set /a sn+=1
echo. 答对了﹌ !str!=24
echo.
echo. 用时:%tihs%小时%tims%分%tiss%.%tiscs%秒还不错!^^-^^
echo.**************************************************
echo.--------------------------------------------------
echo. 重新开始..R 退出..Q
set /p inp= ..........

if /i "%inp%"=="R" goto restart
if /i "%%inp"=="Q" goto end
:end
set ti=!time::=!&set tisc3=!ti:~-2!&&set tih3=!ti:~0,2!&&set tim3=!ti:~2,-5!&&set tis3=!ti:~4,-3!
set /a tihs=!tih3!-%tih%&set /a tims=!tim3!-%tim%&set /a tiss=!tis3!-%tis%&set /a tiscs=!tisc3!-%tisc%
if %tihs% LSS 0 (set /a tihs=!tihs!+24)
if %tims% LSS 0 (set /a tims=!tims!+60&set /a tihs=!tihs!-1)
if %tiss% LSS 0 (set /a tiss=!tiss!+60&set /a tims=!tims!-1)
if %tiscs% LSS 0 (set /a tiscs=!tiscs!+100&set /a tiss=!tiss!-1)
cls
color 0d
echo.__________________________________________________
echo.统计:
echo.--------------------------------------------------
echo.用时(总): %tihs%小时%tims%分%tiss%.%tiscs%秒
echo.
echo.产生随机数:!ns!次
echo.
echo. 成功计算 :%sn%次
echo.
echo. 失败计算 :%fn%次
set /a sp=(%sn%*100)/(%fn%+%sn%)
echo.
echo. 成功率 :!sp!%%
echo.__________________________________________________&set /p= <nul&date /t
echo.--------------------------------------------------
echo. 杏杏工作室QQ:274343972 群号:1699720
echo. 任意键退出..&pause >nul&exit
:bar
set /a pack=!n!*100/49
rem set /p=正在产生随机数...<nul
ping /n %sleep% 127.1>nul
set /a a=%1%%10
set /a c=%a%%%4
if %a% EQU 0 set s=!s!▌&set /p =!s!<nul
if %c% EQU 3 (set/p=^|<nul) else (set/p=!b:~%a%,1!<nul)
set /p=%dell%<nul
endlocal
goto :eof




山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
2008-5-9 20:18
查看资料  发短消息  网志   编辑帖子  回复  引用回复
bat-zw
金牌会员

永远的学习者


积分 3105
发帖 1276
注册 2008-3-8
状态 离线
『第 3 楼』:   使用 LLM 解释/回答一下

加油干,兄弟!



批处理之家新域名:www.bathome.net
2008-5-9 20:31
查看资料  发送邮件  发短消息  网志  OICQ (841615149)  编辑帖子  回复  引用回复
joyn
中级用户

丶杏灬丶


积分 280
发帖 105
注册 2008-5-6
来自 广西
状态 离线
『第 4 楼』:   使用 LLM 解释/回答一下

嗯~~还有一个BUG~~你们发现没~~~

2008-5-9 22:52
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: