>
>
36D杯-杂项-Match3Game
ThTsOd
from pwn import *
import time
r=remote("124.156.121.112",28008)
#r=process("./a.out")
context.log_level='warn'
board=[]
def checkmatch():
for x in range(8):
for y in range(8):
if(y+1<8 and y+2<8 and board[x][y]==board[x][y+1]==board[x][y+2]):
return True
if(x+1<8 and x+2<8 and board[x][y]==board[x+1][y]==board[x+2][y]):
return True
return False
def checkmove(x,y,d):
#hor
if d==0:
if(y+1>=8):
return False
temp=board[x][y]
board[x][y]=board[x][y+1]
board[x][y+1]=temp
result=checkmatch()
temp=board[x][y]
board[x][y]=board[x][y+1]
board[x][y+1]=temp
#vec
elif d==1:
if(x+1>=8):
return False
temp=board[x][y]
board[x][y]=board[x+1][y]
board[x+1][y]=temp
result=checkmatch()
temp=board[x][y]
board[x][y]=board[x+1][y]
board[x+1][y]=temp
return result
move=""
t1=time.time()
r.sendline()
while(1):
move=""
board=[]
r.recvuntil("-----------------\n")
r.recvline()
for i in range(8):
board.append(list(r.recvline()[1:-1]))
for i in range(8):
for j in range(8):
if(checkmove(i,j,0)):
move=str(j)+str(i)+'D'
if(checkmove(i,j,1)):
move=str(j)+str(i)+'S'
if(move==""):
continue
else:
r.sendline(move)
#print(move)
t2=time.time()
if(t2-t1>38):
context.log_level='debug'
PS.可以去玩玩Bejeweled
PPS.限制步数就要考虑消除数量了,这个可能太难就去掉了。限制时间就可以无脑乱消看运气过。
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论