[轉錄][轉錄][轉錄] 俄羅斯囧塊...殺時間用
※ [本文轉錄自 seiranryuki 信箱]
作者: seiranryuki.bbs@ptt2.cc (seiranryuki.bbs@ptt2.cc)
標題: [轉錄][轉錄] 俄羅斯囧塊...殺時間用
時間: Tue Apr 26 13:42:27 2011
作者: seiranryuki (周小呆) 看板: delighted
標題: [轉錄][轉錄] 俄羅斯囧塊...殺時間用
時間: Tue Apr 26 13:40:41 2011
※ [本文轉錄自 planet_b612 看板 #1DcLjxyZ ]
作者: wfes8226 (西吟氏:小行星慢跑) 看板: planet_b612
標題: [轉錄] 俄羅斯囧塊...殺時間用
時間: Mon Apr 4 13:47:37 2011
※ [本文轉錄自 看板 #1DcL2gP8 ]
作者: flylitlig (光.こう)
標題: [轉錄][轉錄] 俄羅斯囧塊...殺時間用
時間: Sun Apr 3 19:36:22 2011
※ [本文轉錄自某隱形看板]
按下大寫L才可以開始遊戲呦
-----------------------------
還滿好玩的XDDDDDDDD
鄉民應該很適合玩這種的 | 【 Tetris score:100 lines:0 level:0 】
|
俄羅斯囧塊 | │ 囧囧囧 │ N E X
(我在原程式上加上了遊戲結束畫面 | │ 囧囧囧 │
還有應大家要求 把█改成囧..XD) | │ 囧 │ 囧囧囧
| │ 囧囧 │ 囧
| │ 囧囧 │
請按大寫L開始遊戲:p | │ 囧囧囧 │
| │ 囧 │
| │ 囧囧囧 │
(原始Tetris開發者:LPH66) | │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| │囧囧囧囧囧囧囧囧囧囧│
| └──────────┘
--#BBSLUA
-- Interface: v0.109
-- Title: [BBSLua][練習] Tetris
-- Notes: 按大P開始,Ctrl-C離開;上/空白是旋轉,左右移動,D掉一格,下掉到底,Q暫停
-- Author: LPH66
-- Version: V1.031
score=0
line=0
level=0
next=1
speed=0.7
holdtime=0
bottomtime=1
bottomdead=0
active={{0,0},{{0,0},{0,0},{0,0},{0,0}}}
dropclock=0
WIDTH=10
HEIGHT=20
field={}
for i=1,HEIGHT do
field[i]={}
for j=1,WIDTH do
field[i][j]=0
end
end
blockdata={
--█□██ █□
-- ██
{{0,-1},{0,0},{0,1},{0,2}}, {{0,-1},{0,0},{1,0},{1,1}},
--█□█ █□█
--█ █
{{0,-1},{0,0},{0,1},{1,-1}}, {{0,-1},{0,0},{0,1},{1,1}},
-- □█ █□█
--██ █
{{0,0},{0,1},{1,-1},{1,0}}, {{0,-1},{0,0},{0,1},{1,0}},
--█□
--██
{{0,-1},{0,0},{1,-1},{1,0}}
}
BLOCK22=7
function show()
bbs.clear()
bbs.title('Tetris score:'..score..' lines:'..line..' level:'..level)
for i=1,HEIGHT do
bbs.move(i+1,10)
bbs.color(0)
bbs.outs('│')
for j=1,WIDTH do
if field[i][j]==0 then
bbs.color(0)
bbs.outs(' ')
elseif field[i][j]<0 then
bbs.color(1,30)
bbs.outs('囧')
else
bbs.color(1,30+field[i][j]%10)
bbs.outs('囧')
end
end
bbs.color(0)
bbs.outs('│')
end
bbs.move(HEIGHT+2,10)
bbs.outs('└')
for i=1,WIDTH do bbs.outs('─') end
bbs.outs('┘')
bbs.move(2,16+WIDTH*2)
bbs.outs('N E X T')
for i=1,4 do
bbs.move(4+blockdata[next][i][1],22+(WIDTH+blockdata[next][i][2])*2)
bbs.color(1,30+next)
bbs.outs('囧')
end
bbs.move(HEIGHT+2,9)
bbs.refresh()
end
function generate()
local blnum,blinfo,r
r=true;
blnum=next
blinfo=blockdata[blnum]
if(field[blinfo[1][1]+1][blinfo[1][2]+5]~=0) then r=false end
if(field[blinfo[2][1]+1][blinfo[2][2]+5]~=0) then r=false end
if(field[blinfo[3][1]+1][blinfo[3][2]+5]~=0) then r=false end
if(field[blinfo[4][1]+1][blinfo[4][2]+5]~=0) then r=false end
field[blinfo[1][1]+1][blinfo[1][2]+5]=blnum+10
field[blinfo[2][1]+1][blinfo[2][2]+5]=blnum+10
field[blinfo[3][1]+1][blinfo[3][2]+5]=blnum+10
field[blinfo[4][1]+1][blinfo[4][2]+5]=blnum+10
active={{1,WIDTH/2},
{{blinfo[1][1],blinfo[1][2]},
{blinfo[2][1],blinfo[2][2]},
{blinfo[3][1],blinfo[3][2]},
{blinfo[4][1],blinfo[4][2]}}}
dropclock=bbs.clock()-speed/2
next=math.random(7)
return r
end
function getactive()
return active[1][1],active[1][2],active[2]
end
function drop()
local x,y,m,k
x,y,m=getactive()
k=field[x][y]
for i=1,4 do
if x+m[i][1]==HEIGHT then return false end --bottommost
if field[x+m[i][1]+1][y+m[i][2]]<10 and field[x+m[i][1]+1][y+m[i][2]]>0 then
return false
end
end
for i=1,4 do field[x+m[i][1]][y+m[i][2]]=0 end
for i=1,4 do field[x+m[i][1]+1][y+m[i][2]]=k end
active[1][1]=active[1][1]+1
return true
end
function right()
local x,y,m,k
x,y,m=getactive()
k=field[x][y]
for i=1,4 do
if y+m[i][2]==WIDTH then return false end --rightmost
if field[x+m[i][1]][y+m[i][2]+1]<10 and field[x+m[i][1]][y+m[i][2]+1]>0 then
return false
end
end
for i=1,4 do field[x+m[i][1]][y+m[i][2]]=0 end
for i=1,4 do field[x+m[i][1]][y+m[i][2]+1]=k end
active[1][2]=active[1][2]+1
return true
end
function left()
local x,y,m,k
x,y,m=getactive()
k=field[x][y]
for i=1,4 do
if y+m[i][2]==1 then return false end --leftmost
if field[x+m[i][1]][y+m[i][2]-1]<10 and field[x+m[i][1]][y+m[i][2]-1]>0 then
return false
end
end
for i=1,4 do field[x+m[i][1]][y+m[i][2]]=0 end
for i=1,4 do field[x+m[i][1]][y+m[i][2]-1]=k end
active[1][2]=active[1][2]-1
return true
end
function rotate()
local x,y,m,k,temp
x,y,m=getactive()
k=field[x][y]
if k%10==BLOCK22 then return true end --no need to rotate
for i=1,4 do
if x+m[i][2]<1 or x+m[i][2]>HEIGHT or y-m[i][1]<1 or y-m[i][1]>WIDTH then
return false
end
if field[x+m[i][2]][y-m[i][1]]<10 and field[x+m[i][2]][y-m[i][1]]>0 then
return false
end
end
for i=1,4 do field[x+m[i][1]][y+m[i][2]]=0 end
for i=1,4 do field[x+m[i][2]][y-m[i][1]]=k end
temp={0,0,0,0}
for i=1,4 do
if m[i][1]==0 then
active[2][i]={m[i][2],0}
else
active[2][i]={m[i][2],-m[i][1]}
end
end
return true
end
function clearrow()
local z,ln
ln=0
for i=HEIGHT,1,-1 do
z=1
for j=1,WIDTH do
if field[i][j]==0 then z=0; break end
end
if z==1 then
for j=1,WIDTH do field[i][j]=-1 end
ln=ln+1
end
end
show()
bbs.sleep(0.1)
for i=HEIGHT,1,-1 do
while field[i][1]==-1 do
for j=i,2,-1 do
field[j]=field[j-1]
end
field[1]={0,0,0,0,0,0,0,0,0,0}
end
end
return ln
end
function solid()
local x,y,m,l
x,y,m=getactive()
field[x+m[1][1]][y+m[1][2]]=field[x+m[1][1]][y+m[1][2]]%10
field[x+m[2][1]][y+m[2][2]]=field[x+m[2][1]][y+m[2][2]]%10
field[x+m[3][1]][y+m[3][2]]=field[x+m[3][1]][y+m[3][2]]%10
field[x+m[4][1]][y+m[4][2]]=field[x+m[4][1]][y+m[4][2]]%10
active=0
l=clearrow()
if l>0 then
line=line+l
score=score+l*l*(level+6)*(level+7)
if line>=(level+1)*20 then
level=level+1
speed=speed*0.85+0.015 --limit @ 0.015/(1.0.85)=0.1
end
end
end
next=math.random(7)
generate()
show()
flag=0
repeat
if bbs.kbhit(speed/5) then --try to not overload system
key=bbs.getch()
if key=='UP' or key==' ' then
rotate()
elseif key=='DOWN' then
do
local c=0
while drop() do c=c+1 end
score=score+math.floor(c*(level+6)*(level+7)/2/HEIGHT+0.5)
end
solid()
if not generate() then break end
flag=0
elseif key=='LEFT' then
left()
elseif key=='RIGHT' then
right()
elseif key=='d' or key=='D' then
if flag==0 then
if not drop() then flag=1; bottomdead=bbs.clock()-speed+bottomtime end
else
if bbs.clock()>bottomdead then
flag=0
if not drop() then
solid()
if not generate() then break end
end
end
end
dropclock=bbs.clock()
elseif key=='q' or key=='Q' then
holdtime=bbs.clock()-dropclock
bbs.pause('按任意鍵恢復...')
dropclock=bbs.clock()-holdtime
end
end
if(bbs.clock()-dropclock>speed) then
if flag==0 then
if not drop() then flag=1; bottomdead=bbs.clock()-speed+bottomtime end
else
if bbs.clock()>bottomdead then
flag=0
if not drop() then
solid()
if not generate() then break end
end
end
end
dropclock=bbs.clock()
end
show()
until false
show()
for i = HEIGHT + 1, 2, -1 do
bbs.color(1 ,31+i%5, 40 )
bbs.move(i,12); bbs.outs('囧囧囧囧囧囧囧囧囧囧')
bbs.sleep(0.15)
end
bbs.color(0,7)
bbs.move(HEIGHT/2+1,WIDTH+2); bbs.outs('┌────────┐')
bbs.move(HEIGHT/2+2,WIDTH+2); bbs.outs('│GAMEOVER│')
bbs.move(HEIGHT/2+3,WIDTH+2); bbs.outs('└────────┘')
bbs.move(HEIGHT/2+4,WIDTH+2); bbs.outs(' 請按ENTER離開... ')
while bbs.getch()~='ENTER' do end
bbs.color(0)
--#BBSLUA
--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 140.112.247.17
→
04/04 13:19,
04/04 13:19
→
04/04 13:37,
04/04 13:37
→
04/04 13:37,
04/04 13:37
→
04/04 13:47,
04/04 13:47
--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 111.240.208.12
→
04/04 13:48,
04/04 13:48
→
04/04 14:23,
04/04 14:23
→
04/04 14:35,
04/04 14:35
→
04/04 17:49,
04/04 17:49
※ wowokuo:轉錄至某隱形看板 04/04 17:49
※ wwg922:轉錄至看板 El_gatito 04/06 22:15
※ loveiiu:轉錄至看板 ChemReaction 04/22 04:04
※ peter50504:轉錄至看板 peter50504 04/23 21:00
→
04/26 13:40,
04/26 13:40
--
★☆ 良人的良人是良人 ☆★
--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 163.25.118.149
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.25.118.149
推
04/26 18:42, , 1F
04/26 18:42, 1F
推
04/27 21:32, , 2F
04/27 21:32, 2F
推
04/28 00:41, , 3F
04/28 00:41, 3F
→
04/28 22:03, , 4F
04/28 22:03, 4F
→
04/28 22:05, , 5F
04/28 22:05, 5F
※ 編輯: seiranryuki 來自: 61.224.174.136 (04/28 22:41)