标题: [游戏娱乐] 15 段数码管时钟 [打印本页]
作者: aa77dd@163.com 时间: 2016-10-8 00:40 标题: 15 段数码管时钟
我之前发过 7 段数码管, 增加到 15 段并不复杂, 一直懒得写, 现在就补全了
显示原理是逻辑运算, 如果是学过数字电路译码器的道友, 看到这些代码会有很熟悉的感觉, 这个逻辑原理不是我原创, 但批处理实现是我原创的
测试于 Win7 64位 及 XP 32位
这次我把显示数字增加到了百分秒, 让你感觉很快, 是不是很快呢, 鬼才知道
- :: Fifteen-segment display clock
- ::
- :: 20161007_205515
- ::
- :: The following pattern code is not necessary, just to illustrate the logical principle of the show
- ::
- :: ### # ### ### # # ### ### ### ### ### ABC
- :: # # # # # # # # # # # # # # DEF
- :: # # # ### ### ### ### ### # ### ### GHI
- :: # # # # # # # # # # # # # JKL
- :: ### # ### ### # ### ### # ### ### MNO
-
- set "_A="A = !!(x-1)""
- set "_B="B = (!!(x-1) ^& !!(x-4))""
- set "_C="C = 1""
- set "_D="D = (!(x^&3) ^| !!(x^&~3)) ^& !!(x-7)""
- REM set "_E="E = 0"" & rem never display
- set "_F="F = !!(x-5)^&!!(x-6)""
- set "_G="G = !!(x-1)^&!!(x-7)""
- set "_H="H = !(!x ^| !(x-1) ^| !(x-7))""
- set "_I="I = 1""
- set "_J="J = ~x ^& 1 ^& !!(x-4)""
- REM set "_K="K = 0"" & rem never display
- set "_L="L = !!(x-2)""
- set "_M="M = (!!(x-1) ^& !!(x-4) ^& !!(x-7))""
- set "_N="N = (!!(x-1) ^& !!(x-4) ^& !!(x-7))""
- set "_O="O = 1""
-
-
- @echo off & setlocal enabledelayedexpansion
-
- for /f "tokens=2 delims=[]" %%a in ('ver') do for /f "tokens=2 delims=. " %%a in ("%%a") do (
- set /a "NO_CLS=-((%%a-7)>>31)"
- )
-
- set /a "wid=37, hei=6, linesWantBackAbove = hei - 1, cntBS = 2 + (wid + 7) / 8 * linesWantBackAbove"
- set "TAB= " & for /F %%a in ('echo prompt $H ^| cmd') do Set "BS=%%a"
- set "BSs=" & for /L %%a in (1 1 !cntBS!) do set "BSs=!BSs!%BS%"
-
- color 0a & mode %wid%,%hei%
-
- set "__=0" & set "_= "
- for /l %%i in () do (
- set /a "t=!time:~-1!" & set /a "t ^= z, z ^= t"
- if !t! neq 0 (
- set "S=" & set "zeroOrOne=0"
- for %%L in ("A B C" "D _ F" "G H I" "J _ L" "M N O") do (
- for %%d in (0 _ 1 _ : _ 3 _ 4 _ : _ 6 _ 7 _ : _ 9 _ 10) do (
- if "%%d" geq "0" (
- set "tm=!time: =0!" & set "x=!tm:~%%d,1!"
- for %%_ in (%%~L) do set /a !_%%_! & set "S=!S!!%%_!"
- ) else if "!zeroOrOne!%%d"=="1:" (set "S=!S!*") else set "S=!S! "
- )
- set /a "zeroOrOne^=1"
- )
- set "S=!S:1=#!" & set "S=!S:0= !"
-
- if !NO_CLS!==1 ( (2>nul echo;%TAB%!BSs!) & <nul set /p "=%BS%"
- ) else CLS
-
- <nul set /p "=!S!"
- )
- )
复制代码
作者: Bella 时间: 2016-10-8 01:03
本帖最后由 Bella 于 2016-10-8 01:04 编辑
位运算大师
作者: 523066680 时间: 2016-10-8 08:40
楼主做生命游戏一定很6
作者: codegay 时间: 2016-10-8 09:36
http://blog.csdn.net/conmajia/article/details/7603873
在进化的过程中,出现了一些有意思的现象。
有的细胞在非常健康(HP>80+)的时候,也会追着弱小的实验体「咬」,杀死实验体后,HP增加不到5点,而代码中,标称值是在HP<70时才开始觅食,且会整个吃掉尸体。
有的实验体甚至有了那么一点点的「智力」(或者说仅仅是种本能),比如这个第6392代的家伙,它只要吃饱了,就会「绕场一周」,而且总是往墙上撞,企图逃跑。
太可怕了。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |