⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xiangqi.txt

📁 步步高的电子词典上的 ZWBasic语言游戏中国象棋(双人版)_简约版 源码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
		putpct(x,y,13,9,pic77!)
	case 78
		putpct(x,y,13,9,pic78!)
	case 79
		putpct(x,y,13,9,pic79!)
	case 80
		putpct(x,y,13,9,pic80!)
	case 81
		putpct(x,y,13,9,pic81!)
	end select
end sub





function check(m)
	check=0
	if m=13 or m=23 then
		if (px(2)>px(1))*(py(2)=py(1)) then
			s=0
			for a=px(1) to px(2)
				if map2(a,py(1))>10 then s=s+1
			next a
			if ((s=1)+(s=2))*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
				check=1
				goto 1
			end if
		end if
		if (px(2)<px(1))*(py(2)=py(1)) then
			s=0
			for a=px(2) to px(1)
				if map2(a,py(1))>10 then s=s+1
			next a
			if ((s=1)+(s=2))*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
				check=1
				goto 1
			end if
		end if
		if (px(2)=px(1))*(py(2)>py(1)) then
			s=0
			for a=py(1) to py(2)
				if map2(px(1),a)>10 then s=s+1
			next a
			if ((s=1)+(s=2))*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
				check=1
				goto 1
			end if
		end if
		if (px(2)=px(1))*(py(2)<py(1)) then
			s=0
			for a=py(2) to py(1)
				if map2(px(1),a)>10 then s=s+1
			next a
			if ((s=1)+(s=2))*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
				check=1
				goto 1
			end if
		end if
	else if m=15 or m=25 then
		if (px(2)=pX(1)-2)*(py(2)=py(1)-2)*(px(2)>aa(p))*(px(2)<bb(p))*(map2(px(1)-1,py(1)-1)=10)*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
			check=1
			goto 1
		end if
		if (px(2)=pX(1)-2)*(py(2)=py(1)+2)*(px(2)>aa(p))*(px(2)<bb(p))*(map2(px(1)-1,py(1)+1)=10)*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
			check=1
			goto 1
		end if
		if (px(2)=pX(1)+2)*(py(2)=py(1)-2)*(px(2)>aa(p))*(px(2)<bb(p))*(map2(px(1)+1,py(1)-1)=10)*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
			check=1
			goto 1
		end if
		if (px(2)=pX(1)+2)*(py(2)=py(1)+2)*(px(2)>aa(p))*(px(2)<bb(p))*(map2(px(1)+1,py(1)+1)=10)*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
			check=1
			goto 1
		end if
	else if m=17 or m=27 then
		if (px(2)>cc(p))*(px(2)<dd(p))*(py(2)>3)*(py(2)<7)*(((px(2)=px(1)-1)*(py(2)=py(1)))+((px(2)=px(1)+1)*(py(2)=py(1)))+((px(2)=px(1))*(py(2)=py(1)-1))+((px(2)=px(1))*(py(2)=py(1)+1)))*(not((map2(px(2),py(2))>mm(p))*(map2(px(2),py(2))<nn(p)))) then
			check=1
			goto 1
		end if
		if (p=1)*(map2(px(2),py(2))=27)*(py(2)=py(1)) then
			s=0
			for a=px(2) to px(1)
				if map2(a,py(1))>10 then s=s+1
			next a
			if s=2 then
				check=1
				goto 1
			end if
		end if
		if (p=2)*(map2(px(2),py(2))=17)*(py(2)=py(1)) then
			s=0
			for a=px(1) to px(2)
				if map2(a,py(1))>10 then s=s+1
			next a
			if s=2 then
				check=1
				goto 1
			end if
		end if
	end if
	1 a=0
end function





sub start()
	cls
	timerclose()
	locate(3,6):print "整理中..."
	a=1
	for b=1 to 9
		for c=1 to 10
			map1(c,b)=data1(a)
			map2(c,b)=data2(a)
			inc a
		next c
	next b
	cls
	putpct(16,7,127,81,pic30!)
	for a=1 to 10
		for b=1 to 9
			if map2(a,b)>10 then showit(a*14-4,b*10-7,map2(a,b))
		next b
	next a
	p=1
	xx=142
	yy=47
	press=0
	show=1
	lcdreverse(xx-6,yy-4,xx+6,yy+4)
	timeropen(30)
	delay(30)
	do
		k=getkey()
		if k=135 then
			lcdreverse(xx-6,yy-4,xx+6,yy+4)
			inc show
		else if k=128 then
			if show mod 2=1 then lcdreverse(xx-6,yy-4,xx+6,yy+4)
			yy=yy-10
			if yy<7 then yy=87
			lcdreverse(xx-6,yy-4,xx+6,yy+4)
			show=1
		else if k=129 then
			if show mod 2=1 then lcdreverse(xx-6,yy-4,xx+6,yy+4)
			yy=yy+10
			if yy>87 then yy=7
			lcdreverse(xx-6,yy-4,xx+6,yy+4)
			show=1
		else if k=131 then
			if show mod 2=1 then lcdreverse(xx-6,yy-4,xx+6,yy+4)
			xx=xx-14
			if xx<16 then xx=142
			lcdreverse(xx-6,yy-4,xx+6,yy+4)
			show=1
		else if k=130 then
			if show mod 2=1 then lcdreverse(xx-6,yy-4,xx+6,yy+4)
			xx=xx+14
			if xx>142 then xx=16
			lcdreverse(xx-6,yy-4,xx+6,yy+4)
			show=1
		else if k=113 then
			exit do
		else if k=13 then
			if press=0 then
				fx=(xx-2)/14
				fy=(yy+3)/10
				if (map2(fx,fy)>mm(p))*(map2(fx,fy)<nn(p)) then
					px(1)=fx
					py(1)=fy
					press=1
					if show mod 2=0 then lcdreverse(xx-6,yy-4,xx+6,yy+4)
					show=0
				end if
			else if press=1 then
				px(2)=(xx-2)/14
				py(2)=(yy+3)/10
				if (px(2)=px(1))*(py(2)=py(1)) then
					showit(xx-6,yy-4,map2(px(2),py(2)))
					lcdreverse(xx-6,yy-4,xx+6,yy+4)
					show=1
					press=0
				else
					kk=map2(px(1),py(1))
					yeah=check(kk)
					if kk=11 or kk=21 or kk=12 or kk=22 or kk=14 or kk=24 or kk=16 or kk=26 then yeah=1
					if yeah=1 then
						showit(px(1)*14-4,py(1)*10-7,map1(px(1),py(1)))
						showit(xx-6,yy-4,map2(px(1),py(1)))
						if map2(px(2),py(2))=17 or map2(px(2),py(2))=27 then
							if p=1 then
								locate(3,8):print "红方胜"
							else if p=2 then
								locate(3,8):print "黑方胜"
							end if
							box(55,31,104,48)
							timerclose()
							pause
							exit do
						end if
						map2(px(2),py(2))=map2(px(1),py(1))
						map2(px(1),py(1))=10
						press=0
						lcdreverse(xx-6,yy-4,xx+6,yy+4)
						show=1
						if p=1 then
							p=2
						else if p=2 then
							p=1
						end if
					end if
				end if
			end if
		end if
	loop
end sub





11 cls
sysprtstrg(40,24,"Start Game")
sysprtstrg(56,40,"Readme")
sysprtstrg(43,56,"Quit Game")
lcdreverse(40,24,119,39)
timerclose()
a=1
do
	k=getkey()
	if k=128 then
		lcdreverse(40,8+16*a,119,23+16*a)
		dec a
		if a=0 then a=3
		lcdreverse(40,8+16*a,119,23+16*a)
	else if k=129 then
		lcdreverse(40,8+16*a,119,23+16*a)
		inc a
		if a=4 then a=1
		lcdreverse(40,8+16*a,119,23+16*a)
	else if k=13 then
		if a=1 then
			start()
			exit do
		else if a=2 then
			readme()
			exit do
		else if a=3 then
			runend()
		end if
	end if
loop
goto 11
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -