Welcome to RetroCoders Community
Randomize Timer
Screen 17 ' Ideal Screen Size (80x25 characters)
' Welcome
Color 2
Print "Ski Slope Challenge! By electricwalrus (2022)"
Print "Try to last on this slope as long as possible"
Print
Print "Use the arrow keys to move left and right down the slope"
Print
Print "Press any key to begin!"
Sleep
Dim score As Integer, x As Integer, player As Integer
Do
Cls
Print "Get Ready!"
Sleep 1000, 1
score = 0: x = 40: player = x
Do
Select Case Int(Rnd * 2)
Case 0: If x > 10 Then x = x - 1
Case 1: If x < 70 Then x = x + 1
End Select
Locate 25, x - 9: Color 11: Print "* *";
If MultiKey(1) Then End
If MultiKey(75) Then player = player - 1
If MultiKey(77) Then player = player + 1
Select Case player - x
Case Is < -8, Is > 6: Exit Do
End Select
Locate 25, player: Color 10: Print "!!"
Sleep 100, 1
score = score + 1
Loop
Beep
Sleep 1000, 1
Cls
Locate 1, 1
Color 6
Print "You crashed on the ski-field!"
Print "Score:"; score
Print
Color 15
Print "Try Again in 5 seconds"
Sleep 5000, 1
Loop
Const CoinColor = 14, MonsterColor = 12, PlayerColor = 15
Const CoinCharacter = chr(248), MonsterCharacter = chr(234)
Const PlayerCharacter = chr(153)
Type TPosition
Dim X as byte
Dim Y as byte
End Type
Declare Function IsValid (position as Const TPosition) as boolean
Declare Sub Invalidate (position as TPosition)
Declare Function IsAtSamePosition (a as Const TPosition, b as Const TPosition) as boolean
Declare Function CheckCollisions (position as Const TPosition, others() as TPosition, doInvalidate as boolean) as integer
Declare Sub SetRandom (position as TPosition)
Declare Sub MoveLeft (position as TPosition)
Declare Sub MoveRight (position as TPosition)
Declare Sub MoveUp (position as TPosition)
Declare Sub MoveDown (position as TPosition)
Declare Sub PrintAt (position as Const TPosition, text as Const String)
Declare Sub PlayLevel (ByRef score as integer, ByRef level as integer, ByRef lives as byte)
Declare Sub UpdateScore (score as integer, level as integer, lives as integer)
Dim Score as integer
Dim Level as integer
Dim Lives as byte
Randomize Timer
Screen 19
' Welcome Screen
Cls
Color 14
Locate 17, 35
Print "---- Welcome to Coin Hunt! ---"
Locate 18, 35
Print " MagicalWizzy (2022)"
Locate 20, 20
Print "Collect all the coins without being attacked by the monsters :)"
Locate 21, 35
Print " Press any key to begin."
Sleep
' First Start Variables
Score = 0
Level = 1
Lives = 3
Do
PlayLevel Score, Level, Lives
Loop
Private Function IsValid (position as Const TPosition) as boolean
IsValid = position.X <> 0
End Function
Private Sub Invalidate (position as TPosition)
position.X = 0
End Sub
Private Function IsAtSamePosition (a as Const TPosition, b as Const TPosition) as boolean
IsAtSamePosition = a.X = b.X AndAlso a.Y = b.Y
End Function
Private Function CheckCollisions (position as Const TPosition, others() as TPosition, doInvalidate as boolean) as integer
Dim count as integer = 0, i as integer
For i = 1 to UBound(others)
If IsAtSamePosition(position, others(i)) Then
count = count + 1
If doInvalidate Then Invalidate(others(i))
End If
Next
CheckCollisions = count
End Function
Private Sub SetRandom (position as TPosition)
position.X = Int(Rnd * 98) + 2: position.Y = Int(Rnd * 35) + 2
End Sub
Private Sub MoveLeft (position as TPosition)
position.X = position.X - 1
If position.X <= 2 Then position.X = 2
End Sub
Private Sub MoveRight (position as TPosition)
position.X = position.X + 1
If position.X >= 99 Then position.X = 99
End Sub
Private Sub MoveUp (position as TPosition)
position.Y = position.Y - 1
If position.Y <= 2 Then position.Y = 2
End Sub
Private Sub MoveDown (position as TPosition)
position.Y = position.Y + 1
If position.Y >= 36 Then position.Y = 36
End Sub
Private Sub PrintAt (position as Const TPosition, text as Const String)
If IsValid(position) Then Locate position.Y, position.X: Print text;
End Sub
Sub PlayLevel (ByRef score as integer, ByRef level as integer, ByRef lives as byte)
Dim isOddCycle as boolean
Dim i as integer, coinsCollected as integer = 0
Dim player as TPosition = (51, 18)
Dim coins(20 + (level - 1) * 5) as TPosition
Dim monsters(10 + (level - 1) * 5) as TPosition
' Draw Border
Cls
Color 9
Print chr(201);: For i=1 to 98: Print chr(205);: Next: Print chr(187);
For i = 2 to 36
Locate i, 1: Print Chr(186)
Locate i, 100: Print Chr(186);
Next
Print chr(200);: For i=1 to 98: Print chr(205);: Next: Print chr(188);
Color 15
Locate 1, 36: Print " Coin Hunt! by MagicalWizzy "
UpdateScore score, level, lives
' Initialise and draw Coins and Monsters
For i = 1 to UBound(coins)
Do
SetRandom coins(i)
Loop While IsAtSamePosition(coins(i), player)
Next
For i = 1 to UBound(monsters)
Do
SetRandom monsters(i)
' Check if Monster is too close to player.
Loop Until Abs(monsters(i).Y - player.Y) > 4 _
And Abs(monsters(i).X - player.X) > 4
Next
' Draw Coins and Monsters
Color CoinColor
For i = 1 to UBound(coins)
PrintAt coins(i), CoinCharacter
Next
Color MonsterColor
For i = 1 to UBound(monsters)
PrintAt monsters(i), MonsterCharacter
Next
' Draw Player
Color PlayerColor
PrintAt player, PlayerCharacter
' Main Game Loop
Do
' Check if Player moves...
If MultiKey(1) Then End ' Escape pressed, close game
isOddCycle = Not isOddCycle
If isOddCycle Then
Color PlayerColor
PrintAt player, " "
If MultiKey(77) Then MoveRight Player
If MultiKey(75) Then MoveLeft player
If MultiKey(72) Then MoveUp player
If MultiKey(80) Then MoveDown player
PrintAt player, PlayerCharacter
End If
' Check if monster eats player
If CheckCollisions(player, monsters(), False) <> 0 Then
Locate 17, 32
Color 11
Print "A monster just ate you for breakfast!"
Beep
Sleep 5000, 1
Beep
lives = lives - 1
If lives = 0 Then End
Exit Sub
End If
' Check if Player found coins.
i = CheckCollisions(player, coins(), True)
If i > 0 Then
coinsCollected = coinsCollected + i
score = score + i
UpdateScore score, level, lives
End If
' Problems with coins disappearing - redrawing all coins
Color CoinColor
For i = 1 to UBound(coins)
PrintAt coins(i), CoinCharacter
Next
' Move monsters about.
For i = 1 to UBound(monsters)
Color CoinColor
PrintAt monsters(i), _
IIf(CheckCollisions(monsters(i), coins(), False) <> 0, _
CoinCharacter, " ")
Select Case int(rnd*6)+1
Case 1: MoveLeft monsters(i)
Case 2: MoveRight monsters(i)
Case 3: MoveUp monsters(i)
Case 4: MoveDown monsters(i)
Case Else ' Monster stays still
End Select
Color MonsterColor
PrintAt monsters(i), MonsterCharacter
Next
' Check if monster eats player
If CheckCollisions(player, monsters(), False) <> 0 Then
Locate 17, 32
Color 11
Print "A monster just ate you for breakfast!"
Beep
Sleep 5000, 1
Beep
lives = lives - 1
If lives = 0 Then
Cls
Print "You got"; score; " coins. Well done. You did well. Game over."
Sleep 5000, 1
end
End If
Exit Sub
End If
If coinsCollected >= UBound(coins) Then
Locate 17,28
Color 11
Print "Great Job - You got all the coins! Level up."
Beep
Sleep 3000, 1
Beep
level = level + 1
Exit Sub
End If
Sleep 70, 1
Loop
Beep: Sleep: End
End Sub
Private Sub UpdateScore (score as integer, level as integer, lives as integer)
Dim i as byte
Color 9
Locate 37, 1
Print chr(200);: For i=1 to 98: Print chr(205);: Next: Print chr(188);
Color 11
Locate 37, 3
Print " Score:"; score; " ";
Locate 37, 46
Print " Level:"; level; " ";
Locate 37, 89
Print " Lives:"; lives; " ";
End Sub

t$ = TIME$
hour = VAL(LEFT$(t$, 2))
minute = VAL(MID$(t$, 4, 2))
sec = VAL(RIGHT$(t$, 2))
enum TResult
SUCCESS, NEUTRAL, FAILED, MAX = FAILED
end enum
dim reactions(TResult.MAX) as string = { "is happy", "is apathetic", "cries" }
dim stats(TResult.MAX) as integer, choice as integer, result as TResult
Randomize
do
Cls
print "It's a new day in 1988."
print "Options:"
print "1. Feed Avishai"
print "2. Give him medications"
print "3. Take him to the public garden"
print "4. Play music for him"
print "5. Put Avishai to bed"
print "6. Exit the game"
input choice
Cls
select case choice
case 1 to 5
result = Cast(TResult, Int(Rnd * (TResult.MAX + 1)))
print "Avishai "; reactions(result); "."
stats(result) += 1
case 6
print "Exiting the game."
GetKey
exit do
case else
print "Invalid choice. Try again."
end select
GetKey
loop
locate 20, 1
print "Avishai was happy"; stats(SUCCESS); " times."
print "Avishai was sad"; stats(FAILED); " times."
GetKey
'THIS IS A MATRIX PROGRAM, BY JOHN. W. SZCZEPANIAK
' converted from qb to fb by ron77 2023-08-25
RANDOMIZE: SCREEN 19
DIM i AS LONG, rows AS INTEGER, columns AS INTEGER, text AS STRING
i = WIDTH: rows = HIWORD(i): columns = LOWORD(i)
COLOR 2 ' Green
DO
LOCATE INT(RND * (rows - 1)) + 1, INT(RND * (columns - 1)) + 1
PRINT CHR(INT(RND * 227) + 28)
SLEEP 5 ' about 200 characters per second.
LOOP UNTIL INKEY <> "" ' = CHR(27)
CLS
text = "THE MATRIX HAS YOU"
LOCATE rows \ 2, (columns - LEN(text)) \ 2
PRINT text
SLEEP