'Program thinsweeper
Uses "console"
Global i, j, x, y As Integer
Global hbuffer As Long
Global Cell(17, 13) As Integer
Global CellStatus(17, 13) As Integer
Global Mines As Integer
Global Score As Integer
Global Found As Integer
Global MinesLeft As Integer
Sub InitBoard()
Dim B(25) As String
B(1) = "ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
B(2) = "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÕÍÍÍÍÍÍÍÍÍÍÍ͸³"
B(3) = "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅ´ THINSWEEPERô"
B(4) = "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÔÍÍÍÍÍÍÍÍÍÍÍ;³"
B(5) = "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´ ³"
B(6) = "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÕÍÍÍÍÍÍÍÍÍÍÍ͸³"
B(7) = "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅ´ By ô"
B(8) = "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³³ ChandraMDE ³³"
B(9) = "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅ´ Thin Basic ô"
B(10) = "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÔÍÍÍÍÍÍÍÍÍÍÍ;³"
B(11)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´ ³"
B(12)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÕÍÍÍÍÍÍÍÍÍÍÍ͸³"
B(13)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅ´ STATUS ô"
B(14)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ÆÍÍÍÍÍÍÍÍÍÍÍ͵³"
B(15)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´³ Mines ( ) ³³"
B(16)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³³ Found ( ) ³³"
B(17)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´³ Left ( ) ³³"
B(18)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³³ Skor( ) ³³"
B(19)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÅÄÄÄÄÄÄÄÄÄÄÄÄÅ´"
B(20)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³³ ÛÛÛÛÛÛÛÛÛÛ ³³"
B(21)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ³"
B(22)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ MY WEBSITE ³"
B(23)= "ÃÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄÅÄÄÄ´ /telinks ³"
B(24)= "³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ @wordPress ³"
B(25)= "ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
Cls()
hbuffer = Console_CreateScreenBuffer
Console_SetActiveScreenBuffer(hbuffer)
Console_SetTitle("THINSWEEPER - Chandra MDE, http://teknikelektrolinks.com")
Console_HideCursor
For i=1 To 25
Console_PrintAt_Buffer(B(i), 1, i, 8, hbuffer)
Next
Console_PrintAt_Buffer("THINSWEEPER", 68, 3, 14, hbuffer)
Console_PrintAt_Buffer("By", 72, 7, 14, hbuffer)
Console_PrintAt_Buffer("ChandraMDE", 68, 8, 12, hbuffer)
Console_PrintAt_Buffer("Thin Basic", 68, 9, 15, hbuffer)
Console_PrintAt_Buffer("STATUS", 70, 13, 14, hbuffer)
Console_PrintAt_Buffer("Mines ( )", 68, 15, 12, hbuffer)
Console_PrintAt_Buffer("Found ( )", 68, 16, 10, hbuffer)
Console_PrintAt_Buffer("Left ( )", 68, 17, 11, hbuffer)
Console_PrintAt_Buffer("Skor( )", 68, 18, 13, hbuffer)
Console_PrintAt_Buffer("MY WEBSITE", 68, 22, 14, hbuffer)
Console_PrintAt_Buffer(" /telinks ", 68, 23, 10, hbuffer)
Console_PrintAt_Buffer("@wordpress", 68, 24, 11, hbuffer)
End Sub
'***********************
' Cell Initialization
'***********************
Sub InitCell()
Local nb, xp, xm, yp, ym As Byte
For x = 1 To 16
For y = 1 To 12
Cell(x, y) = 0
CellStatus(x, y) = 0
Next
Next
Randomize Timer
Mines = Rnd(5, 45)
For i = 1 To Mines
x = Rnd(1, 16)
y = Rnd(1, 12)
Cell(x, y) = -1
Next
Score = 0
Found = 0
MinesLeft = Mines
For x = 1 To 16
For y = 1 To 12
If Cell(x, y) = -1 Then Next
nb = 0
xp = x + 1
xm = x - 1
yp = y + 1
ym = y - 1
If xp<=16 Then
If Cell(xp, y) = -1 Then Incr nb
End If
If xm>=1 Then
If Cell(xm, y) = -1 Then Incr nb
End If
If yp<=12 Then
If Cell(x, yp) = -1 Then Incr nb
End If
If ym>=1 Then
If Cell(x, ym) = -1 Then Incr nb
End If
If (xp<=16) And (yp<=12) Then
If Cell(xp, yp) = -1 Then Incr nb
End If
If (xp<=16) And (ym>=1) Then
If Cell(xp, ym) = -1 Then Incr nb
End If
If (xm>=1) And (yp<=12) Then
If Cell(xm, yp) = -1 Then Incr nb
End If
If (xm>=1) And (ym>=1) Then
If Cell(xm, ym) = -1 Then Incr nb
End If
Cell(x, y) = nb
Next
Next
End Sub
'************************
' Printing Game Status
'************************
Sub PrintStatus()
Console_PrintAt_Buffer(Format$ (Mines, "00"), 75, 15, 15, hbuffer)
Console_PrintAt_Buffer(Format$ (Found, "00"), 75, 16, 15, hbuffer)
Console_PrintAt_Buffer(Format$ (MinesLeft, "00"), 75, 17, 15, hbuffer)
Console_PrintAt_Buffer(Format$ (Score, "0000"), 73, 18, 15, hbuffer)
End Sub
'*********************************
' Print Cell (Revealed)
'*********************************
Sub PrintCell()
For x = 1 To 16
For y = 1 To 12
Select Case Cell(x, y)
Case -1 'bomb
Console_PrintAt_Buffer(Chr$(1), 3+(x-1)*4, 2+2*(y-1), 12, hbuffer)
Case 0 'space
Console_PrintAt_Buffer(Chr$(249), 3+(x-1)*4, 2+2*(y-1), 7, hbuffer)
Case Else
Console_PrintAt_Buffer(Format$(Cell(x, y), "0"), 3+(x-1)*4, 2+2*(y-1), 8+Cell(x, y), hbuffer)
End Select
Next
Next
End Sub
'***************************
' Print Cell (Unrevealed)
'***************************
Sub PrintClosedCell()
For x = 1 To 16
For y = 1 To 12
Console_PrintAt_Buffer(Chr$(254), 3+(x-1)*4, 2+2*(y-1), 4, hbuffer)
Next
Next
End Sub
'--------------------------------- Let's Go!
'Display ThinSweeper Cells 5 times
Dim count As Integer
InitBoard()
For count=1 To 5
InitCell()
PrintStatus()
PrintCell()
Console_WaitKey(2)
Next
PrintClosedCell()
Console_WaitKey()
'------------------ End of Program
Some screenshots:
Bookmarks