特效(玩家选择的凸出效果)做出来了,效率很高,大家可以接着做其它部分。
是根据变量chu中的#和@来区别是否选择来进行显示的,对后面的开发很方便。
代码如下,欢迎测试。
- @echo off
- ::用于特效显示的数所初始化
- (set chu0=$
- set m1=1
- set m2=2
- set m3=3
- set m4=
-
- set a$#0= &rem 定义尾巴
- set b$#0=—=—=╮
- set c$#0= │
- set d$#0= │
- set e$#0= │
- set f$#0=批 §│
- set g$#0= 处 │
- set h$#0=§ 理│
- set i$#0=━=━=╯
-
- set a$@0=—=—=╮
- set b$@0= │
- set c$@0= │
- set d$@0= │
- set e$@0=批 §│
- set f$@0= 处 │
- set g$@0=§ 理│
- set h$@0=━=━=╯
- set i$@0=
-
- set a$#1=—=╮
- set b$#1=—=┷=╮
- set c$#1= │
- set d$#1= │
- set e$#1= │
- set f$#1=批 §│
- set g$#1= 处 │
- set h$#1=§ 理│
- set i$#1=━=━=╯
-
- set a$@1=—=—=╮
- set b$@1= │
- set c$@1= │
- set d$@1= │
- set e$@1=批 §│
- set f$@1= 处 │
- set g$@1=§ 理│
- set h$@1=━=┯=╯
- set i$@1=━=╯
-
- set a$#2=╮
- set b$#2=┷=—=╮
- set c$#2= │
- set d$#2= │
- set e$#2= │
- set f$#2=批 §│
- set g$#2= 处 │
- set h$#2=§ 理│
- set i$#2=━=━=╯
-
- set a$@2=—=—=╮
- set b$@2= │
- set c$@2= │
- set d$@2= │
- set e$@2=批 §│
- set f$@2= 处 │
- set g$@2=§ 理│
- set h$@2=┯=━=╯
- set i$@2=╯
-
- set a@00$=╭=
- set b@00$=│!ob!
- set c@00$=│!oc!
- set d@00$=│
- set e@00$=│
- set f@00$=│
- set g@00$=│
- set h@00$=╰=
- set i@00$= &rem 突出第一个,第一位
-
- set a@10=╭=
- set b@10=┥!ob!
- set c@10=┊!oc!
- set d@10=┊
- set e@10=┊
- set f@10=┊
- set g@10=┊
- set h@10=╰-
- set i@10=━=&rem 突出第N个,第N位,变换
-
- set a@12=╭=
- set b@12=┥!ob!
- set c@12=┊!oc!
- set d@12=┊
- set e@12=┊
- set f@12=┊
- set g@12=┊
- set h@12=╰-
- set i@12=━=&rem 突出第N个,第1,2位,变换
-
- set a@13=╭=
- set b@13=┥!ob!
- set c@13=┊!oc!
- set d@13=┊
- set e@13=┊
- set f@13=┊
- set g@13=┊
- set h@13=╰-
- set i@13=━=&rem 突出第N个,第3位,变换
-
- set a@0=╭=
- set b@0=┊!ob!
- set c@0=┊!oc!
- set d@0=┊
- set e@0=┊
- set f@0=┊
- set g@0=┊
- set h@0=╰=
- set i@0= &rem 突出第N个,第N位
-
- set a@2=╭=
- set b@2=┊!ob!
- set c@2=┊!oc!
- set d@2=┊
- set e@2=┊
- set f@2=┊
- set g@2=┊
- set h@2=╰-
- set i@2=━=&rem 突出第N个,第2位
-
- set a@3=╭=
- set b@3=┊!ob!
- set c@3=┊!oc!
- set d@3=┊
- set e@3=┊
- set f@3=┊
- set g@3=┊
- set h@3=╰-
- set i@3=╯ &rem 突出第N个,第3位
-
-
-
-
- set a#00$= &rem 不突第一个
- set b#00$=╭=
- set c#00$=│!ob!
- set d#00$=│!oc!
- set e#00$=│
- set f#00$=│
- set g#00$=│
- set h#00$=│
- set i#00$=╰=
-
- set a#10=—=&rem 不突第N个,第N位,变换
- set b#10=╭=
- set c#10=┊!ob!
- set d#10=┊!oc!
- set e#10=┊
- set f#10=┊
- set g#10=┊
- set h#10=┤
- set i#10=╰=
-
- set a#12=—=&rem 不突第N个,第1,2位,变换
- set b#12=╭=
- set c#12=┊!ob!
- set d#12=┊!oc!
- set e#12=┊
- set f#12=┊
- set g#12=┊
- set h#12=┤
- set i#12=╰=
-
- set a#13=—=&rem 不突第N个,第3位,变换
- set b#13=╭=
- set c#13=┊!ob!
- set d#13=┊!oc!
- set e#13=┊
- set f#13=┊
- set g#13=┊
- set h#13=┤
- set i#13=╰=
-
- set a#0= &rem 不突第N个,第1位
- set b#0=╭=
- set c#0=┊!ob!
- set d#0=┊!oc!
- set e#0=┊
- set f#0=┊
- set g#0=┊
- set h#0=┊
- set i#0=╰=
-
- set a#2=—=&rem 不突第N个,第2位
- set b#2=╭=
- set c#2=┊!ob!
- set d#2=┊!oc!
- set e#2=┊
- set f#2=┊
- set g#2=┊
- set h#2=┊
- set i#2=╰=
-
- set a#3=╮ &rem 不突第N个,第3位
- set b#3=╭=
- set c#3=┊!ob!
- set d#3=┊!oc!
- set e#3=┊
- set f#3=┊
- set g#3=┊
- set h#3=┊
- set i#3=╰=
-
- )
-
- setlocal enabledelayedexpansion
- ::为了显示方便,用p代替10
- ::定义花色数据
- set a1=&set a2=&set a3=&set a4=&set a5=&set a6=
-
- (::定义显示缓存
- set ec1= ┌──┐
- set ec2= │ 17 │
- set ec3= │ │ ┍=┑
- set ec4= │ 张 │ │1│
- set ec5= │ │ │!a6!│
- set ec6= ╘≡≡╛ ┕=┙
- set ec7=
- set ec8=
- set ec9= ┌──┐
- set ec10= │ 12 │
- set ec11= ┍=┑ │ │
- set ec12= │2│ │ 张 │
- set ec13= │!a5!│ │ │
- set ec14= ┕=┙ ╘≡≡╛
- set ec15=
- set ec16=
- set ec17=
- set ec18=
- set ec19=
- set ec20=
- set ec21=
- set ec22=
- set ec23= ┍=┑
- set ec24= │8│
- set ec25= │!a6!│
- set ec26= ┕=┙
- set ec36= a b c d e f g h i j k l m n o p q
- )
- set n=0
- for %%a in (a b c d e f g h i j k l m n o p q) do (set w%%a=!n!&set/a n=n+1)
-
- ::随机排序54张牌(洗牌)
- for %%a in (3 4 5 6 7 8 9 p J Q K A 2) do (for %%b in (!a3! !a5! !a4! !a6!) do (set #p!random!.%%a-%%b=1))
- set #P!random!.w-!a1!=1
- set #P!random!.W-!a2!=1
-
- ::发牌,并留三张底
- set/a m=0,n=0
- for /f "tokens=2 delims==." %%a in ('set #p') do (
- set /a m=m%%3+1,n+=1
- if !n! leq 51 (
- for %%c in (!m!) do (
- set he%%c=!he%%c! %%a
- )
- ) else (set di=!di! %%a)
- )
- set he&echo 显示三家牌
- echo.
- set di&echo 显示底牌
- echo.
-
- ::整理各家手上的牌
- for /l %%a in (1,1,3) do (
- setlocal enabledelayedexpansion
- for %%b in (!he%%a!) do (
- for /f "tokens=1,2 delims=-" %%c in ("%%b") do (
- set p.d%%c=!p.d%%c! %%c
- set p.f%%c=!p.f%%c! %%d
- )
- )
- for %%b in (3 4 5 6 7 8 9 p J Q K A 2 w) do (
- set pai%%ad=!pai%%ad!!p.d%%b!
- set pai%%af=!pai%%af!!p.f%%b!
- )
- for /f "tokens=1,2 delims=." %%b in ("!pai%%ad:* =!.!pai%%af:* =!") do (
- endlocal
- set pai%%ad=%%b
- set pai%%af=%%c
- )
- )
-
- set pai&echo 显示整理好各家的牌
- echo.
- pause
- mode con: cols=100 lines=200
- echo.
-
- set pad=!pai1d: =!
- set paf=!pai1f: =!
- ::测试用,玩家选择的为:@,没选为:#
- set chu=#########################
-
- :loop
- set c#=@
- set c@=#
-
- set a1=
- set/a n=16,@=4,#=4
- set is@=$
- setlocal enabledelayedexpansion
- for /l %%a in (0,1,!n!) do (
- for %%z in (!chu:~%%a^,1!) do (
- set hu=&set var=
- if %%z neq !is@! (
- set/a var=!is@!
- set/a hu=m!var!
- set is@=%%z&set %%z=1
- if %%a equ 0 set %%z=4
- ) else (set /a !is@!+=1)
- if !is@! equ @ (set/a n@#=m!@!) else (set/a n@#=m!#!)
- set var=!n@#!!hu!
- if !n@#!!hu! equ 11 set var=12
- for /f "tokens=1-4" %%b in ("!pad:~%%a,1! !paf:~%%a,1! !var! !chu%%a!") do (
- set oc=%%c&set ob=%%b
-
- rem 测试用变量显示:echo b%%z%%d%%e !@!-!#! !b%%z%%d%%e! !var!
-
- for %%i in (a b c d e f g h i) do (
- for %%j in ("!%%i%%z%%d%%e!") do (
- set %%iN=!%%iN!%%~j
- ) )
-
- ))
- )
-
- if !n@#! equ 3 set n@#=0
- for %%i in (a b c d e f g h i) do (
- for %%j in ("%%i$!is@!!n@#!") do (
- set %%iN=!%%iN!!%%~j!
- ) )
-
- set "spac= "
-
- endlocal&(set ec27=%spac%%an%
- set ec28=%spac%%bn%
- set ec29=%spac%%cn%
- set ec30=%spac%%dn%
- set ec31=%spac%%en%
- set ec32=%spac%%fn%
- set ec33=%spac%%gn%
- set ec34=%spac%%hn%
- set ec35=%spac%%in%)
- ::把玩家的牌处理结果送到显示缓存
-
- :error
- ::把显示缓存进行显示输出
- cls
- (for /l %%a in (1,1,36) do echo;!ec%%a!
- set /p input=选择要出牌:
- set chu=%chu%
- for %%a in (a b c d e f g h i j k l m n o p q) do (for %%b in (!w%%a!) do set input=!input:%%a= %%b !)
- for %%a in (!input!) do (
- if %%a gtr 20 goto :error
- if %%a lss 0 goto :error
- set/a var=1+%%a
- for /f "tokens=1,2" %%b in ("!chu:~%%a,1! !var!") do (
- set chu=!chu:~,%%a!!c%%b!!chu:~%%c!
- )
- ))
- goto :loop
-
-
- echo !a1! !a2! !a3! !a4! !a5! !a6!
-
- pause
复制代码
|