Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Framework BRL.GlMax2D
- Import BRL.StandardIO
- Import BRL.Random
- Global Board:Int[14,14]
- Board = New Int[14,14]
- ' draw lines
- Graphics 800,600
- HideMouse
- SetBlend alphablend
- Global cursorX,cursorY
- Global Scores:Int[]
- Scores = New Int[2]
- Global baseBoardX:Int = 72
- Global baseBoardY:Int = 72
- Global boardOriginX:Int = 72
- Global boardOriginY:Int = 72
- Global Shake:Float
- Global Letters:TList = New TList
- Type TLetter
- Field X:Int
- Field Y:Int
- Field sY:Float
- Field sX:Int
- Field Char:Int
- Field word:String
- Field scalex:Float
- Field scaley:Float
- EndType
- Function AnyWord:String()
- Select Rand(0,10)
- Case 0
- Return "Nincopomp"
- Case 1
- Return "Homosexual"
- Case 2
- Return "Rectal prolapse"
- Case 3
- Return "Fecal mass"
- Case 4
- Return "Poo"
- Case 5
- Return "British Media"
- Case 6
- Return "George W Bush"
- Case 7
- Return "Barack Obama"
- Case 8
- Return "RAGING HOMOPHOBE"
- Case 9
- Return "RACIST"
- Case 10
- Return "THIEF"
- EndSelect
- EndFunction
- For Local I:Int = 0 To 200
- Local L:TLetter
- L = New TLetter
- Letters.AddLast(L)
- L.sY = 10
- L.Word = AnyWord()
- Next
- Function DrawBackground()
- SetAlpha 1
- SetRotation 0
- For Local L:TLetter = EachIn Letters
- L.sY :+ 0.2
- L.Y:+L.sY
- L.X:+L.sX
- If Rand(0,10)=2 Then
- L.Char:+1
- EndIf
- If Rand(0,5)=1 Then SetColor Rand(0,1)*255,Rand(0,1)*255,Rand(0,1)*255
- SetScale l.scalex,l.scaley
- DrawText L.Word,L.X,L.Y
- If L.Y > 600 Or ( L.X < 0) Or (L.X > 800) And (Rand(0,100)=3)Then
- L.X =Rand(0,800)
- L.Y =Rand(0,600)
- L.sY=Rand(-3,3)*10
- L.sX=Rand(-3,3)*10
- L.Char = Rand(32,255)
- l.scalex = Rand(1,2)
- l.scaley = Rand(1,2)
- L.Word = AnyWord()
- EndIf
- Next
- EndFunction
- Function FartLetters(X:Int,Y:Int)
- For Local I:Int = 0 To 10
- Local L:TLetter = TLetter(Letters.RemoveLast())
- L.X = X
- L.Y = Y
- L.sX = Rand(-10,10)
- L.sY = Rand(-10,10)
- L.scaleX = Rnd(3,5)
- l.scaleY = Rnd(3,5)
- Select turn
- Case 1
- L.Word = "NIGGAZ TURN"
- Case 2
- L.Word = "CRACKAZ TURN"
- EndSelect
- Letters.AddFirst(L)
- Next
- EndFunction
- Repeat
- Shake :* Shake
- If shake < 0.1 Then shake = 0
- If (Rand(0,100)=10) Then Shake=Rnd(0.4,0.5)
- cursorX = ((MouseX()+24-boardOriginX) / 24)
- cursorY = ((MouseY()+24-boardOriginY) / 24)
- If cursorX < 0 Then cursorX = 0
- If cursorX > 13 Then cursorX = 13
- If cursory < 0 Then cursory = 0
- If cursory > 13 Then cursory = 13
- If MouseHit(1)
- PlaceStone()
- EndIf
- boardOriginX = baseBoardX + (Shake * Rnd(-10,10))
- boardOriginY = baseBoardY + (Shake * Rnd(-10,10))
- SetClsColor Rand(1,0)*255*Shake , Rand(1,0)*255*Shake, Rand(1,0)*255*Shake
- If Rand(0,100)>Rand(1,3)*10 Then Cls()
- SetScale 2.2 * ( 1 + Abs(Cos(MilliSecs()/10)*Sin(MilliSecs()/50))),4
- SetColor(Rand(100,255),Rand(100,255),Rand(100,255))
- SetRotation 15 * ( (Cos(MilliSecs()/10)*Sin(MilliSecs()/50)))
- DrawText("Race War 2000",400,10)
- DrawBackGround()
- SetScale 1,1
- SetRotation 0
- DrawBoard()
- DrawStones()
- If shake>0 Then
- baseboardx = Rand(64,300)
- baseboardy = Rand(64,200)
- Cls
- EndIf
- Flip()
- Delay 20
- If AppTerminate() Or KeyHit(KEY_ESCAPE) Then Exit
- Forever
- Global turn = 1 ' whites start
- Function PlaceStone()
- LastPlaced = CursorX*100 + CursorY
- 'If board[cursorX,cursorY]<>0 Then Return
- fartletters( MouseX(), MouseY())
- shake = 0.999
- board[cursorX,cursorY]=Turn
- If turn=2
- turn=1
- Else
- turn=2
- EndIf
- Global CheckedForGroup:Int[14,14]
- CheckedForGroup = New Int[14,14]
- ' check for groups of stones
- Function AddStoneToGroup:TList(Group:TList,X:Int,Y:Int,fromX:Int=0,fromY:Int=0)
- ' this stone isn't in a group yet,
- ' so I add it to the list
- If(CheckedForGroup[X,Y]) Return
- CheckedForGroup[X,Y]=True
- Local Pos:Int[]
- pos = New Int[2]
- pos[0] = x
- pos[1] = y
- Group.AddLast( Pos )
- ' Adds the one to the right, unless we came from there
- If (X<13)
- If(Board[X+1,Y]=Turn)And ((X+1 > fromX))
- AddStoneToGroup(Group,X+1,Y,X,Y)
- EndIf
- EndIf
- ' The one to the left
- If (X>0)
- If(Board[X-1,Y]=Turn)And ((X-1 < fromX))
- AddStoneToGroup(Group,X-1,Y,X,Y)
- EndIf
- EndIf
- ' Adds the one to the bottom, unless we came from there
- If (Y<13)
- If(Board[X,Y+1]=Turn)And((Y+1>fromY))
- addstoneToGroup(group,X,Y+1,x,y)
- EndIf
- EndIf
- ' adds the one to the top, unless we came from there
- If (Y>0)
- If(Board[X,Y-1]=Turn)And((Y-1<fromY))
- addstoneToGroup(group,X,Y-1,x,y)
- EndIf
- EndIf
- Return group
- EndFunction
- Local x:Int,y:Int
- Local groups:TList
- Groups=New TList
- Local EnemyPieces:Int
- EnemyPieces=0
- For X = 0 To 13
- For Y = 0 To 13
- If Board[X,Y]=Turn Then EnemyPieces:+1
- If CheckedForGroup[X,Y] = False
- If Board[X,Y]=Turn
- Local Group:TList
- Group = New TList
- AddStoneToGroup(Group,X,Y,X,Y)
- Groups.AddLast(Group)
- EndIf
- EndIf
- Next
- Next
- Local I:Int
- I=0
- For Local L:TList = EachIn Groups
- I:+1
- drawboard()
- drawstones()
- Local CheckedForLiberty:Int[,]
- CheckedForLiberty = New Int[14,14]
- Local Liberties:Int
- liberties=0
- Local A:Int[]
- For A = EachIn L
- X = A[0]
- Y = A[1]
- ' Count the liberties of each position
- ' To the left
- If X > 0 Then
- If CheckedForLiberty[X-1,Y]=False Then
- CheckedForLiberty[X-1,Y]=True
- If Board[X-1,Y] = 0 Then Liberties:+1
- EndIf
- EndIf
- ' To the right
- If X < 13 Then
- If CheckedForLiberty[X+1,Y]=False Then
- CheckedForLiberty[X+1,Y]=True
- If Board[X+1,Y]=0 Then Liberties:+1
- EndIf
- EndIf
- ' Top
- If Y > 0 Then
- If CheckedForLiberty[X,Y-1]=False Then
- CheckedForLiberty[X,Y-1]=True
- If Board[X,Y-1] = 0 Then Liberties:+1
- EndIf
- EndIf
- ' Bottom
- If Y < 13 Then
- If CheckedForLiberty[X,Y+1]=False Then
- CheckedForLiberty[X,Y+1]=True
- If Board[X,Y+1]=0 Then Liberties:+1
- EndIf
- EndIf
- Next
- If Liberties=0
- For A = EachIn L
- Board[A[0],A[1]]=0
- EnemyPieces:-1
- Next
- EndIf
- If EnemyPieces=0 Then GameOver()
- Next
- Groups.Clear()
- CheckedForGroup=Null
- EndFunction
- Function GameOver()
- Local Color:String
- If Turn = 1 Then Color = "Niggaz"' Whites obliterated
- If Turn = 2 Then Color= "Crackaz"
- For Local I:Int = 0 To 600
- SetClsColor(Rnd(100,255),Rnd(100,255),0)
- Cls
- SetRotation (Rnd(0,13))
- SetScale Rnd(1,2)*2.4,Rnd(1,2)*2.5
- SetColor(Rand(100,244),Rand(100,255),Rand(100,255))
- DrawText Color + " Wins!",64+ 20*Rnd(-1,1), 64 + 20*Rnd(-1,1)
- SetColor(0,0,0)
- DrawText Color + " Wins!",60+ 20*Rnd(-1,1), 60 + 20*Rnd(-1,1)
- Flip
- If KeyHit(KEY_ESCAPE) Then Exit
- Next
- SetScale 1,1
- Board = New Int[14,14]
- EndFunction
- Function DrawBoard()
- SetOrigin boardOriginX,boardOriginY
- SetAlpha 1
- Local x:Int
- Local y:Int
- ' Verticles
- For x = 0 To 13
- SetColor 255 * ( Abs(Cos(MilliSecs()*X/10))),255,255 * ( Abs(Cos(MilliSecs()*X/10)))
- DrawLine X * 24, 0, X*24, 13*24
- Next
- ' Horizontiles
- For y = 0 To 13
- SetColor 255 * ( Abs(Sin(MilliSecs()*y/10))),255,255 * ( Abs(Sin(MilliSecs()*Y/10)))
- DrawLine 0,y*24,13*24,y*24
- Next
- SetOrigin 0,0
- EndFunction
- Global LastPlaced
- Function DrawStones()
- Local x:Int
- Local y:Int
- ' cursor
- DrawText "Position "+x+":"+y,10,10
- SetOrigin boardOriginX,boardOriginY
- ' stones
- SetAlpha 1
- For x = 0 To 13
- For y = 0 To 13
- If LastPlaced = X * 100 + Y
- SetScale 1+Shake,1+Shake
- Else
- SetScale 1,1
- EndIf
- If board[x,y]=1 Then
- SetColor 255,255,255
- Else
- SetColor 75,75,75+ (Rnd(0,1)*255*Shake)
- EndIf
- If board[x,y] <> 0 Then
- DrawOval x*24-11,y*24-11,22,22
- EndIf
- Next
- Next
- SetAlpha 0.5
- SetColor 255,255,0
- DrawOval cursorX*24 -12,cursory*24 -12,24,24
- SetOrigin 0,0
- EndFunction
Add Comment
Please, Sign In to add comment