Your Programming Path

Started by PixelOutlaw, March 11, 2025, 06:59:41

Previous topic - Next topic

PixelOutlaw

I thought I'd create a thread just to hear your programming story.
How did people get started what was the era you stored in?


My first exposure to programming was in elementary school using Logo Writer for the Apple //e computer. I didn't really understand what we were doing at the time and I hadn't quite caught the programming bug then. I think this was mostly due to the teachers not really stressing the right concepts nor really knowing the end goal of programming in the classroom.

I started programming seriously in high school with the earliest version of Mark Overmars' Game Maker. I think I was around 13 at the time. I have fond memories of copying my games to floppy disk so it could be distributed to my friends. Above all else, I think I really valued the feedback it made me feel good that my work was appreciated. Something that silently pushing code to GitHub will never fill.

Later I heard that C++ was the way to develop games so of course I started purchasing and working through C++ books. However, after obtaining all that knowledge I was ultimately let down because I expected C++ to be able to make games easily in a consistent "batteries included" way. I remember picking up languages here and there ... for example I was programming my TI-83 calculator for math class pretty regularly. Spending study halls writing simple games.

Later I learned about BlitzMax (2006ish). It finally started undoing some of the damage that Game Maker had caused. I always been semi-reliant on the icon based scripting of Game Maker and for once I was writing real programs. I was especially happy with some of the advanced blending modes like additive blending and the speed at which it could render sprites and transparency.

A few years later I got into college. There I picked up Python which I felt was an excellently flexible language despite being very slow. I felt it was more expressive than BlitzMax and I did some work using Pygame but I just couldn't get the same speed. You can make games in it, but you can't have a lot of graphics at once.

During college I started learning about text editors and had switched to Linux at that time. I was tired of purchasing Windows and having a free and open source operating system was very appealing - especially with all the programming languages that come with it. At that time, I had settled on Emacs because it was the most configurable text editor. Essentially Emacs is a programming language first tool that happens to cover all the facilities you need for editing text. Even the most primitive operations are exposed through Emacs Lisp such that the user doesn't need to wait for language extensions and has the low level ability to write his own.

I wanted to learn "Lisp" then to begin configuring Emacs so I went to my college library and picked out a book. I thought it was a single language at the time and ended up picking a book on Common Lisp. There is substantial commonality between the two, but essentially it sent me down a path of learning Common Lisp. Time and time and time again in Common Lisp I found things that previously annoyed me had already been done in a more elegant way. It had the most flexible functions I've seen as far as parameters go, it had the most powerful object system I've ever seen resolving diamond inheritance while still being dynamic and extendable itself. It had some of the most powerful loops and formatting that I think exists in any programming language. But the most striking feature is that everything is an expression such that about seven or eight different things in a normal programming language are unified. From there I caught the Lisp bug and learned Emacs Lisp, Common Lisp and Scheme (via the excellent SICP videos).

A few years past and I took some jobs that promise programming but they were never quite real programming. One of the jobs for me to use something absolutely hideous called Tibco Business Works which was a helpless drag and drop tool. I quit that job and decided I was going to write a game for publishing.

After about a year I wrote a game in Python of all things and got a Green Light on Steam. But before I could publish, I was offered a manager of position at a former workplace and so that fell away.

A few years later COVID-19 hit and more jobs started becoming remote. It was at that time that I saw a position for Clojure programming at a reasonably large security company. Learning Clojure for me was very easy as I was already knee deep in about three other Lisp dialects. However, I found that writing web services just wasn't for me. It didn't scratch the right itch and unfortunately our team fell apart as the post COVID layoffs begin. They mounted a Java as a universal language for the company and most of us were totally disinterested at that point. As far as Clojure goes, it will never be a personal favorite - it's kind of limited, short-sighted, and annoying.

I did take some time to continue learning interesting programming languages though while at that company. I dabbled in Prolog - which is a programming language that is not to be missed if he want something that can solve very large problem sets using very complex relations between the pieces of data. I was lucky enough to write a pioneering project in Common Lisp with a Prolog factbase and rule set. It worked well, but ultimately the company never let me advance my research. I also rolled up AutoLISP and uLisp on the side.

I later picked up Smalltalk just to see how their universal object and message passing system worked. It was quite amusing to me to see that objects included numbers themselves such that you could send a number a loop message instead of the language having actual loops. I think there's a lot there to explore and it completely turns current paradigms on their ears having no loops explicitly.

My latest language has been tinkering with Forth I think it's interesting in that it limits the programmer for the convenience of the computer having only a stack and some words that magically call other words that magically get the computation you're looking for. You can turn something like an Arduino into an interactive real time environment. Very powerful for how minimal it is.

For now though I'm enjoying a retreat back to BlitzMax.
When you just want to get some graphics on the screen and make a game quickly for multiple platforms I still consider it the best $80 investment I've made.

So there you have it, that's my story and I'm sticking to it.



One DEFUN to rule them all, One DEFUN to find them, One DEFUN to RETURN them all, and in the darkness MULTIPLE-VALUE-BIND them.

Dabz

Locomotive BASIC (Amstrad CPC)
Z80 Assembly (Amstrad CPC)
*Pause in programming due to discovery of Merrydowne cider and, erm, hormones)*
BlitzBasic (All variants)
MS C# & ASP.NET
C/C++ <--- Not that I had'nt looked at it before, just, when I got the grasp of it.
BlitzMax
Vala
GLBasic
B4X

Other languages like Java or web stuff like HTML, PHP etc over time.

Pretty much it really.

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

PixelOutlaw

#2
Nice history. :)
I wish I could have been a part of the early 8 bit era! (it would have pushed me to learn Assembly)
I do have a Commodore 64 (maxi) and also a Ti-99.
The BASIC on the Commodore 64 is ... OK but the Ti BASIC is TERRIBLE! (being based on a subset of Darthmouth)
One DEFUN to rule them all, One DEFUN to find them, One DEFUN to RETURN them all, and in the darkness MULTIPLE-VALUE-BIND them.

Xerra

I go back to the early 80's, when I was just becoming a teenager and my grandfather gave the family his Vic 20 as he upgraded to a C64. I started with Basic on the Vic 20 and got reasonably proficient with it, but it was so bloody slow, which made games practically pointless, apart from specific designs. I taught myself how to redefine character sets which naturally leant towards understanding how 6502 machine code worked. I got the basics of that but moved onto my own C64 just after I left school, before I did anything meaningful on the Vic. I did submit a type in listing to C&VG magazine sometime in the early eighties, which was a Bomber plane kind of game but they had to reject it because I had two listings and it needed a +3k expansion, which they wouldn't allow at the time.

After I got the C64 I continued with Basic, and got a bit more gritty with machine code but never really mastered it. I never wrote a complete game with it, and my best program was probably when i wrote an alarm system that would trigger from a joystick signal and then run through the sound registers in some stupid kind of random order to create a god-awful noise. I then wired up a pressure mat into a 9 pin socket so I could put it under the carpet and then put the tv volume up on full and just waited to catch my sister going into my room to be noisy. That one worked really well.

Around a year before I left school my mother enrolled me onto a weeks holiday at some naval college where they were teaching kids how to program computers, along with all the other recreational stuff, like football matches, archery and whatever. We didn't get enough computer time for me but I learnt very quickly that I was way out of my league with knowledge compared to some of these other kids. We were using Acorn Electrons and basic to make our games either solo , or as a two person project. I went solo and was very proud of my basic ski down the screen game until I saw some kid had put together his own version of Pacman, complete with hi-res graphics, and some in-built assembler for the monster movement, which made it look almost arcade quality. I didn't win that competition.

After I left home I finally got myself an Amiga - way back in late 1988, as I recall. That was a game changer, and I used the god-awful Amiga basic for a while on that. I even wrote a couple of very simple games with it, but it was quite an adjustment working on this machine, compared to the C64. You couldn't really touch any of the fancy stuff the Amiga did in just basic. After a few years it was the A1200 and then a move onto Amos, both the original version and then the wonderful Amos Pro which you could set up on hard disk to make development a lot less disk-swapping. I got involved with a fair bit of doing PD stuff with this, but didn't really change the world. There's still a demo of a big project I was working on at the time on Aminet archives out there. And my super impressive Pacman game - along with you tube playthrough - because someone seemed to like it. By this time it must have been late 1993.

Blitz came after that, and I was seduced by the Amiga Format magazine give-away, just like a lot of us, I suspect. It took me a huge amount of time to get to grips with that as we didn't have anything like the internet resources we have now, so I was relying on the old BUM disks, anything that made it onto bulletin boards, and just trying to understand other peoples code in those days. I think i stopped coding for quite a long time at some point because running a BBS took up most of my time. When I did return I did a fair few applications with Blitz on the Amiga that did the rounds. I was working freelance for CU Amiga back then, so I used to shunt my stuff on their file archives as well as Aminet, so these programs can still be found today. BlitzDMS was probably my best work, along with a BBS file listing program I created. I sold both those as shareware and made a little money. Not much, i hasten to add. The Amiga was seeing its last days by then. One positive thing I do remember doing back then was reviewing the Blitz Support Suite which some Blitz fans had created to extend the language and released commercially. That was one of my favourite bits of work for CU Amiga as I could use some of my programs in the screenshots, along with source code, as they wanted to review it, but nobody there had any idea what it really was.

I finally made the jump onto PC's and the dreaded Windows 95 back in mid-1997 it must have been. I wanted to build a PC so I'd understand what I was working with better so I had a friend help me source all the parts from a local CEX and off we went. Programming got dropped almost completely then for quite a few years, apart from a brief play with Delphi and learning a bit of Visual Basic 6 in 2001. I didn't stick with either of them beyond some simple programs.

I literally by chance found that Blitz Basic (the original version) had come to PC probably around 2004. I'd been playing around with the Game Factory at the time and had written a pretty good space shooter with that but had lost the disc that I had kept the program data on. So that was my first project with Blitz Basic and it's been around 50% complete for the last 20 years or so. Still have the source code but doubt i'll ever go back to it as it's been a while since I last used Blitz in any format.

After Blitz basic I kind of missed the follow up Blitz+ and ended up getting BlitzMax around 2010, or so. Might have been earlier than that, as my memory is sketchy. I have quite a lot of more incomplete than completed projects with that one. That was my first experience of writing a basic framework project that I used for several games later on. I have fond memories of working with Blitzmax using a really good editor instead of the default that came with the compiler. Blide was my first experience of a proper programmers IDE. I still miss it now.

Around 2015 I started to try and take coding more seriously and worked with objective C - didn't gel with me and Cocos 2d, which was also not comfortable. I tried Unity for a bit, and also had a long time working with Swift but had to move away from that as I might really love Mac's, but everyone wants at least a Windows version of any app/game nowadays. Then I found GameMaker and have been using it ever since. Obviously not done any applications for a long time now, but I've got more than a few games under my belt. I suspect it's a lot different to how it was originally. People who think it's a drag and drop coding thing really have never actually used it. I write as much code - mostly C++ syntax - as any other dev system overall.

During this time I've had a play at going back to my roots by developing Vic 20 games using TRSE. This means coding in Pascal - which is an interesting excersize - but I'm yet to find myself comfortable enough to put out a complete game in that just yet. I do have two that I do work on sporadically, whenever i feel the urge. The challenges of writing a game, including custom graphics, within just under 5k of memory is incredible. 

But now it's GameMaker for now that let's me get my ideas out there. It might change one day but there's something very comfortable about having a system that takes a lot of the heavy stuff out of getting things moving on screen, so you can develop ideas and not get hung up in directX syntax, or other bollocks like that.
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/revenge-of-the-quadra
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

Matty

My programming journey began with walking into K-Mart, finding the display PC, usually a Commodore 64, typing "10 print "hello",, 20 goto 10" typing run and then walking away from the machine.

Our first home PC was in 1988 or so, a PC-XT with a Turbo button to get it all the way up to 10Mhz. It had a 20MB hard disk drive, 4 colours that were all amber, and 640k of RAM.  It had no software so I wrote my own in GW-BASIC.

Programming was something I did now and then, when I was bored with nothing to do.

I kept learning slowly.

Later in life, much later, I took a programming job at a friend's company writing business software in a system he'd once worked for the company that produced it and we had a licence to modify it.

Gradually extended myself to various languages over the years, usually making simple games.

Finished working about 5-6 years ago, and the only reason I code is to keep my mind active with nothing else to do in life.

Alienhead

#5
I'll show my age..   I started with my folks hand me down TI-99/4a ( texas instruments ) from service merchandise.
I feel in love with computers after that experience at a ripe age of 7. lol.  I remember getting a monthly TI magazine in the mail and in the center they always had a 3 to 4 pages of code I had to type in to play the game of the month.  Had to save it to a tape recorder ! hehe.. Ahh those were the days.. Hunt the Wompus !  But believe it or not, after typing those games in from the magazine over a few years, I didnt realize it but I learned how to code, even though it was BASIC. but was a strong foundation I suppose.


dawlane

I will definitely be showing my age.
Started with schools the ZX81 without any RAM upgrade, their ZX Spectrum and their Acorn BBC B.
Eventually got my own 48K ZX Spectrum one birthday, which I still have. That was a machine that really taught you how to manipulated data with how the screen layout worked.

Dabbled with a C64 and Amstrad CPC 464. And I can say that the BBC was the best for tools when it came to write any machine code, as it had a built in assembler.

Like Dabz had some time off killing brain cells, until I ended up with a job that actually paid well to the point that I could afford a PC with Win95 and some serious software.

Started with Borland CBuilder 3, Visual Studio C++ 6 , Delphi 4, MinGW32, and around the same time discovered RedHat 5 back in the late 90s.
Played around with DarkBasic & DarkBasic Pro, Blitz3D, BlitzMax, Monkey, AGK, GLBasic, FreeBasic and PureBasic.
Bought a high-end iMac in 2007, learned Objective-C (what a weird language).

And when I look back, the tools I used back then were far superior to the tools being churned out these days.

Steve Elliott

#7
I started on the ZX Spectrum coding some BASIC and getting UDG (User Defined Graphics) on the screen. But BASIC was too slow for decent games so I mainly played other people's games back then.

I found the Atari 130XE had a much better hardware and a more capable BASIC so I was able to write a few programs there, including some utility programs like a very simple finance program.

The Atari ST arrived and I tried several of the BASIC's, it was a great time for coding with so many development tools available (batteries were included). Seeing an animated droid sprite moving smoothly across the screen via STOS BASIC (without the requirement to learn assembly language) I felt was very impressive. Languages here for me were Fast BASIC, STOS (BASIC) and Hisoft BASIC. I'd heared that GFA BASIC was very good too but didn't try it. Fast BASIC was good for GUI style programs, STOS for games and Hisoft BASIC was like Fast BASIC but because it was a complied language it ran a lot faster. STOS later had a compiler produced for it which I immediately bought.

On the PC I discovered the Blitz languages, great times. Blitz3D, Blitz Plus and BlitzMax. The community was so alive on the official Blitz BASIC site and Krylars site too where I won a coding competition on the theme of a 'Space Invaders type game'. I wrote something along the lines of Galaxian but with powerups called 'Invasion Force'. Pure BASIC then Nuclear BASIC were next and I found Nuclear very impressive both in the syntax and in it's capabilities (including 3D) it ran blazingly fast. In recent years I've been dabbling with AGK, but I'm not a fan of it's syntax. I just can't take to it. Nuclear BASIC has sadly been abandoned.

At college I learnt C, Pascal and COBOL which was a nice change from all the BASIC's I'd tried over the years.  But that was more serious programming rather than writing games. C and Pascal I really took to.

Win11 64Gb 12th Gen Intel i9 12900K 5.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 4.4Ghz Nvidia RTX 2050 8Gb
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.6GHz Nvidia GeForce GTX 1050 2Gb
Linux Mint 8Gb Celeron 2.6Ghz UHD Graphics600
macOS 64Gb M4 Max 16C GPU 40C
Spectrum Next 2Mb

Pfaber11

I had made bits of code over the years from time to time so I knew what programming was about. It really started for me though when I joined this forum and decided I was gonna do this back in November 2017 and started programming with Blitz3D. Bought AGK2 early 2018. Tried out a few languages along the way and AGK Studio with it's syntax is what I like best as I find it intuitive and easier than anything else . I like PureBasic as well although it is large and not as easy as AGK ( just my opinion ). My next game is gonna be completed in AGK Studio and is one I started years ago in AGK but then swapped to something else so did not get completed. This is the only game I've started but not completed (in the time I've been a member here) and is gonna be a shooter and should be good. To get to the point I am with AGK has taken me about 3 years and this is an easy language. Mind a real brain box would be much faster than me at learning this. 



   
Windows 11 home edition
PureBasic 6.20 and AppGameKit studio
ASUS Vivo book i5 15 16gb ram 512gb ssd
ASUS Vivo book i3 15 16gb ram 256gb ssd
HP Desktop; AMD 6700 A10 16GB ram 2 GB graphics card windows 10

Xerra

Quote from: Alienhead on March 11, 2025, 23:11:45I'll show my age..  I started with my folks hand me down TI-99/4a ( texas instruments ) from service merchandise.
I feel in love with computers after that experience at a ripe age of 7. lol.  I remember getting a monthly TI magazine in the mail and in the center they always had a 3 to 4 pages of code I had to type in to play the game of the month.  Had to save it to a tape recorder ! hehe.. Ahh those were the days.. Hunt the Wompus !  But believe it or not, after typing those games in from the magazine over a few years, I didnt realize it but I learned how to code, even though it was BASIC. but was a strong foundation I suppose.


This gave me an excuse to dust off the old storage drive on my desk and dig out my version of Hunt the Wumpus that I wrote back in 2014 in Blitzmax. I did it on New Years Day as well - complete with hangover. This was based on how the original game worked, except my map was more linear as I couldn't get my head round the hexagon-based original version at the time. I totally blame Carlsberg for that one.

As it's written with no custom graphics or sound, here's the complete source code for you nostalgic lot. Same code that I posted in the old BM forums back in the day. IwasAdam might remember, as he played around with it a bit, as I recall.

' Hunt the Wumpus by Tony Brice - January, 2014.
' Modified for OSX June 3, 2015.

' To Do:

' Light up all squares already moved over.
'
' Ideas:
' Expand grid size to 10 * 10 & adjust arrows, hazzards accordingly.
' Message box set up as a scrolling area of message text which can move up screen as new info displayed.
' Score system for number of Wumpus tracked and killed before dying. Could add 10 points each square moved or similar.
' Implement a torch that you can use once to highlight four squares around you.
' Wumpus can move a square in any random direction if he sniffs you. You can move first. If he enters pit, you win.

' Bugs:
' if you hold shift down then you can fire in all directions even if you are on your last shot.

SuperStrict
Import BRL.Random

' Toggle for debug mode
Global Debug:Byte = False

' Toggle for cheating
Global Showall:Byte = False

AppTitle:String = "Hunt the Wumpus !"
Global Width:Int = 800, Height:Int = 600, Depth:Int = 0
Graphics Width, Height, Depth
SetBlend ALPHABLEND
SetMaskColor 0, 0, 0
SeedRnd MilliSecs()
FlushKeys

' Players X and Y location on grid.
Global PlayerX:Int, PlayerY:Int = 0, PX:Int = 0, PY:Int = 0
Global WumpusKilled:Byte = False
Global Score:Int = 0 ' Score to be implemented.
Global Level:Int = 0 ' Levels to be implemented.

'Ingame toggles
Global GameOver:Byte = False ' Locks player movement if active because they have died.
Global GameStatus:Int = 0 ' Used to define game over condition eg: 3= left cave with wumpus still alive.
Global Help:Byte = False ' Toggle if help info is displayed in game.

' Playershot location on grid.
Global ShotFired:Byte = False ' If a shot has been fired then area highlighted until next turn.
Global ShotX:Int = 0, ShotY:Int = 0 ' X & Y location of shot square

' Never-ending pit location on grid.
Global PitX:Int = 0, PitY:Int = 0

' Wumpus location on grid.
Global WumpusX:Int, WumpusY:Int = 0

' Annoying bats location on grid.
Global BatsX:Int, BatsY:Int = 0

' Start with 3 arrows and there are a random amount more hidden in one square on grid.
Global NumberofArrows:Int = 0, ArrowX:Int = 0, ArrowY:Int = 0
Global ArrowsCollected:Byte = False

' Exit location on grid
Global ExitX:Int = 0, ExitY:Int = 0, ExitFound:Byte = False

' Message display
Global Message:String = " "
Global Warning:String = " "

' Define 5*5 grid. Could be expanded with a little work.
' Will need to define the grid using Drawtext "#" in a grid size for/next loop if you want different sizes.
Global MaxGridSizeX:Int = 5, MaxGridSizeY:Int = 5 ' Define grid size to make expanding easier later.
Global GridX:Int = 0, GridY:Int = 0
Global GridArray:Int[MaxGridSizeX, MaxGridSizeY]

Init() ' Set up the grid.

Repeat
Display()

If KeyHit(KEY_R)
' Reset the board
Init()
EndIf

If KeyHit(KEY_D)
' Toggle debug mode
If Debug = True
Debug = False
Else
Debug = True
EndIf
EndIf

If KeyHit(KEY_H) ' Display help screen.
If Help = True
Help = False
Message = " "
Else
Help = True
EndIf
EndIf

If KeyHit(KEY_C)
' Toggle if hazzards shown on grid.
If Showall = True
Showall = False
Else
Showall = True
EndIf
EndIf

If KeyHit(KEY_E) ' You can leave the cave alive if you find the exit before dying and are out of ammo.
If PlayerX = ExitX And PlayerY = ExitY
Message = "You leave the cave safely !"
Warning = " "
GameOver = True
GameStatus = 6 ' Exit the cave with Wumpus still alive.
End If
End If

If KeyHit(KEY_A) ' if cheat on then you can press A for 100 arrows - for testing.
If Showall = True
NumberofArrows = 100
EndIf
EndIf

If GameOver = False

If KeyHit(KEY_DOWN) And PlayerY < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY + 1
Fire()
Else
PlayerY:+1
Movement()
EndIf
EndIf

If KeyHit(KEY_UP) And PlayerY > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY - 1
Fire()
Else
PlayerY:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_LEFT) And PlayerX > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX - 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_RIGHT) And PlayerX < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX + 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:+1
Movement()
EndIf
EndIf

Else ' Game Over has been triggered.

If GameStatus = 0 ' Wumpus caught you.
Message = "Roar! The wumpus caught you !"
Warning = "You've been consumed. Yuck !"
WumpusKilled = False
End If

If GameStatus = 2 ' Fell in the pit.
Message = "You fell in the never ending pit."
Warning = "AAAAaaaarrrrggghhh !!!!!"
WumpusKilled = False
End If

If GameStatus = 1 ' Killed the Wumpus.
Message = "Splat! You just nailed that Wumpus !"
Warning = "Well done !"
WumpusKilled = True
EndIf

If GameStatus = 6 ' Exit the cave alive.
WumpusKilled = True
EndIf

If WumpusKilled = False
SetColor 255, 0, 0 ' Red
DrawText "** Game Over ** You were killed !", 250, 100
Else
SetColor 0, 255, 0 ' Green
DrawText "** Well Done ** You won the game !", 250, 100
EndIf

SetColor 0, 100, 200
DrawText "Press 'R' to Restart", 300, 120
EndIf

Flip
Until KeyHit(KEY_ESCAPE)
End

Function Movement()
Local t:Int = 0
Help = False ' Turn off help screen or results of movement will be unknown.
'Message = " "; Warning = " " ' Clear the status displays so player notices new warnings.

If ShotFired = True
ShotFired = False ' Player moved so cancel displaying the shot and remove from grid.
GridArray[ShotX, ShotY] = 0
EndIf

If GridArray[PlayerX, PlayerY] = 0 ' Player in empty square.
Message = "You are searching the cave."
End If

If GridArray[PlayerX, PlayerY] = 4
If ArrowsCollected = False
ArrowsCollected = True
NumberofArrows:+Rand(1, 5)
Message = "Excellent. You found more arrows."
EndIf
EndIf

If GridArray[PlayerX, PlayerY] = 1
GameOver = True
GameStatus = 0 ' Walked into the Wumpus.
EndIf

If GridArray[PlayerX, PlayerY] = 6
ExitFound = True
Message = "Exit found ! Press `E` to Escape."
EndIf

If GridArray[PlayerX, PlayerY] = 2
GameOver = True
GameStatus = 2 ' Fell into the pit
EndIf

If GridArray[PlayerX, PlayerY] = 3
Message = "Bats found you & dropped you somewhere."
t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
EndIf

' ** Check squares adjacent to player because they have moved. **

Warning = " "

If PlayerX > 0 ' Check East.
NearbyHazzard(PlayerX - 1, PlayerY)
EndIf

If PlayerX < 4 ' Check West.
NearbyHazzard(PlayerX + 1, PlayerY)
EndIf

If PlayerY > 0 ' Check North.
NearbyHazzard(PlayerX, PlayerY - 1)
EndIf

If PlayerY < 4 ' Check South
NearbyHazzard(PlayerX, PlayerY + 1)
EndIf

End Function

Function Lights()

' ** Working here ..... **



' Light up each square on grid already visited.
' May want to stop arrows displaying once they have been collected when this is working.

Local x:Int = 0, y:Int = 0
For x = 0 To 4
For y = 0 To 4
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.
Next
Next

End Function

Function NearbyHazzard(xx:Int, yy:Int)

If GridArray[xx, yy] = 1
Warning = "You can hear snoring nearby !"
End If

If GridArray[xx, yy] = 2
Warning = "You can hear your footsteps echo !"
End If

If GridArray[xx, yy] = 3
Warning = "There's squeaking nearby !"
End If

If GridArray[xx, yy] = 6
Warning = "There's a light in the distance !"
End If

End Function

Function Fire()
Local t:Int = gridarray[shotx, shoty]
Help = False ' Turn off help screen or results of shot will be unknown.
If NumberofArrows > 0
NumberofArrows:-1
ShotFired = True
Message = "You fire into empty space !"
If t = 0
GridArray[ShotX, ShotY] = 5
EndIf

If t = 1
GameOver = True ; WumpusKilled = True
GameStatus = 1
End If

If t = 2
Message = "You hear your shot whistle over a pit !"
ShotFired = False
EndIf

If t = 3
Message = "You hear the fluttering of wings !"
ShotFired = False
End If

If t = 4
If ArrowsCollected = False ' if you have collected arrows already then there would be no ricochet.
Message = "Your shot bounced off something !"
ShotFired = False
EndIf
EndIf

If t = 6
Message = "You hear an echo in the distance !"
ShotFired = False
End If

Else
Message = "You are out of ammunition !"
EndIf

End Function

Function Init()

' This is a bit fiddly how I've done the starting locations but it was the best way I could think of ensuring
' each hazzard was on its own square in the grid as it would be useless for the pit and wumpus to be in the
' same place, for example.

' Note it is theoretically possible for the Exit to be located on a square in the corner and a wumpus under it with
' a hole on the side so you could possibly never win. However, having an exit square does mean you could leave the
' cave, so this may not be an issue. If you are going to highlight the squares , when moved over or hazzards located,
' this this could become obvious to the player........

Local t:Byte = 0
GameOver = False
NumberofArrows = 3
ArrowsCollected = False
Warning = " "
ShotFired = False
WumpusKilled = False
ExitFound = False
GameStatus = 0

' Empty the grid so you dont endlessly loop looking for an empty location. Thanks, Jsp.
For t = 0 To 4
GridArray[0, t] = 0
GridArray[1, t] = 0
GridArray[2, t] = 0
GridArray[3, t] = 0
GridArray[4, t] = 0
Next

' Place the Wumpus on grid. [1]
WumpusX = Rand(0, MaxGridSizeX - 1) ; WumpusY = Rand(0, MaxGridSizeY - 1)
GridArray[WumpusX, WumpusY] = 1

' Place the arrows on grid. [4]
Repeat
ArrowX = Rand(0, MaxGridSizeX - 1) ; ArrowY = Rand(0, MaxGridSizeY - 1)
If GridArray[ArrowX, ArrowY] > 0
t = 0
Else
t = 1
GridArray[ArrowX, ArrowY] = 4
EndIf
Until t = 1

' Place the pit on grid. [2]
t = 0
Repeat
PitX = Rand(0, MaxGridSizeX - 1) ; PitY = Rand(0, MaxGridSizeY - 1)
If GridArray[PitX, PitY] > 0
t = 0
Else
t = 1
GridArray[PitX, PitY] = 2
EndIf
Until t = 1

' Place the bats on grid. [3]
t = 0
Repeat
BatsX = Rand(0, MaxGridSizeX - 1) ; BatsY = Rand(0, MaxGridSizeY - 1)

If GridArray[BatsX, BatsY] > 0
t = 0
Else
t = 1
GridArray[BatsX, BatsY] = 3
EndIf
Until t = 1

' Place the exit on grid. [6]
t = 0
Repeat
ExitX = Rand(0, MaxGridSizeX - 1) ; ExitY = Rand(0, MaxGridSizeY - 1)

If GridArray[ExitX, ExitY] > 0
t = 0
Else
t = 1
GridArray[ExitX, ExitY] = 6
EndIf
Until t = 1

' Player to start in a random location.

' This part checks all squares in the grid so the player can be put on a blank one so it won't be instant game over
' if they were deposited on a pit, for example. A similar check is done when the bats move the player.

t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
Movement() ' Updates location message so player has fair warning if hazzard nearby at start.
End Function

Function Display()
Cls
SetColor 100, 100, 255 ' Blue shade
DrawText AppTitle, 45, 10
SetColor 255, 0, 0 ' Red
DrawText "###########################", 0, 30
DrawText "###########################", 0, 40
DrawText "##  ##  ##  ##  ##  ##", 0, 50
DrawText "##  ##  ##  ##  ##  ##", 0, 60
DrawText "##  ##  ##  ##  ##  ##", 0, 70
DrawText "###########################", 0, 80
DrawText "###########################", 0, 90
DrawText "##  ##  ##  ##  ##  ##", 0, 100
DrawText "##  ##  ##  ##  ##  ##", 0, 110
DrawText "##  ##  ##  ##  ##  ##", 0, 120
DrawText "###########################", 0, 130
DrawText "###########################", 0, 140
DrawText "##  ##  ##  ##  ##  ##", 0, 150
DrawText "##  ##  ##  ##  ##  ##", 0, 160
DrawText "##  ##  ##  ##  ##  ##", 0, 170
DrawText "###########################", 0, 180
DrawText "###########################", 0, 190
DrawText "##  ##  ##  ##  ##  ##", 0, 200
DrawText "##  ##  ##  ##  ##  ##", 0, 210
DrawText "##  ##  ##  ##  ##  ##", 0, 220
DrawText "###########################", 0, 230
DrawText "###########################", 0, 240
DrawText "##  ##  ##  ##  ##  ##", 0, 250
DrawText "##  ##  ##  ##  ##  ##", 0, 260
DrawText "##  ##  ##  ##  ##  ##", 0, 270
DrawText "###########################", 0, 280
DrawText "###########################", 0, 290
SetColor 0, 255, 0 ' Green.
DrawText "Arrows remaining: " + NumberofArrows, 40, 310

SetColor 255, 255, 255 ' White.
DrawText "Use cursor keys to move & hold Shift with cursor keys to fire an arrow.", 0, 360

SetColor 0, 255, 0 ' Green
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.

If Exitfound = True Or Showall = True ' if cheating is true or the exit has been located.
SetColor 0, 200, 100 ' ??
DrawText "E", 25 + (ExitX * 40), 60 + (ExitY * 50) ' Draw exit on grid.
EndIf

SetColor 30, 60, 90
DrawText "Created by Tony Brice - Updated June 3rd, 2015 for OSX", 0, 450

If Help = True
SetColor 0, 255, 200
DrawText "Harry the Hunter, is on the hunt.", 235, 50
DrawText "A few arrows and his trusty bow", 235, 70
DrawText "are all he needs to kill that nasty,", 235, 80
DrawText "smelly Wumpus but be cautious as", 235, 90
DrawText "there are some deadly hazzards in this", 235, 100
DrawText "cave that are really bad for your", 235, 110
DrawText "health...", 235, 120
DrawText "Run out of Ammo? Then look for", 235, 140
DrawText "the exit.", 235, 150
DrawText "Watch out for important messages ", 235, 170
DrawText "as you move around. They may just ", 235, 180
DrawText "save your life...", 235, 190
Else
SetColor 255, 255, 255
DrawText "Messages: ", 235, 30
DrawText "Warning: ", 235, 50
DrawText Message, 320, 30
SetColor 255, 0, 0 ' Red
DrawText Warning, 320, 50
SetColor 255, 255, 255 ' White
End If

If Debug = True
SetColor 255, 0, 255 ' Pink.
DrawText "Debug mode is on:", 0, 400
DrawText "X: " + MouseX() + " Y: " + MouseY(), 145, 400
PX = PlayerX + 1 ; PY = PlayerY + 1
DrawText "Player location : X=" + PX + " , Y=" + PY, 0, 410
DrawText "/ Exit located: ", 225, 410
If ExitFound = True
DrawText "Yes", 350, 410
Else
DrawText "No", 350, 410
EndIf
DrawText "Arrows collected: ", 0, 420
If ArrowsCollected = True
DrawText "Yes", 145, 420
Else
DrawText "No", 145, 420
EndIf
SetColor 255, 255, 255 ' White
DrawText "R to Reset / H for help / Esc to exit / C to cheat.", 0, 350
Else
DrawText "R to Reset / H for help / Esc to exit.", 0, 350
EndIf

If ShotFired = True
' Show where a shot has been fired if active.
SetColor 255, 0, 0 ' Red
DrawText "%", 25 + (ShotX * 40), 60 + (ShotY * 50)
EndIf

If Showall = True
' Cheat mode toggled by pressing "C"
SetColor 255, 0, 0 ' Red.
DrawText "Player is Cheating", 45, 330
SetColor 0, 255, 255 ' Cyan
DrawText "W", 25 + (WumpusX * 40), 60 + (WumpusY * 50)
SetColor 100, 100, 100 ' Grey
DrawText "H", 25 + (PitX * 40), 60 + (PitY * 50)
SetColor 100, 200, 100 ' Dull green
DrawText "B", 25 + (BatsX * 40), 60 + (BatsY * 50)
SetColor 0, 0, 255 ' Blue
DrawText "^", 25 + (ArrowX * 40), 60 + (ArrowY * 50)
EndIf

EndFunction
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/revenge-of-the-quadra
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

Alienhead

Quote from: Xerra on March 12, 2025, 16:47:46
Quote from: Alienhead on March 11, 2025, 23:11:45I'll show my age..  I started with my folks hand me down TI-99/4a ( texas instruments ) from service merchandise.
I feel in love with computers after that experience at a ripe age of 7. lol.  I remember getting a monthly TI magazine in the mail and in the center they always had a 3 to 4 pages of code I had to type in to play the game of the month.  Had to save it to a tape recorder ! hehe.. Ahh those were the days.. Hunt the Wompus !  But believe it or not, after typing those games in from the magazine over a few years, I didnt realize it but I learned how to code, even though it was BASIC. but was a strong foundation I suppose.


This gave me an excuse to dust off the old storage drive on my desk and dig out my version of Hunt the Wumpus that I wrote back in 2014 in Blitzmax. I did it on New Years Day as well - complete with hangover. This was based on how the original game worked, except my map was more linear as I couldn't get my head round the hexagon-based original version at the time. I totally blame Carlsberg for that one.

As it's written with no custom graphics or sound, here's the complete source code for you nostalgic lot. Same code that I posted in the old BM forums back in the day. IwasAdam might remember, as he played around with it a bit, as I recall.

' Hunt the Wumpus by Tony Brice - January, 2014.
' Modified for OSX June 3, 2015.

' To Do:

' Light up all squares already moved over.
'
' Ideas:
' Expand grid size to 10 * 10 & adjust arrows, hazzards accordingly.
' Message box set up as a scrolling area of message text which can move up screen as new info displayed.
' Score system for number of Wumpus tracked and killed before dying. Could add 10 points each square moved or similar.
' Implement a torch that you can use once to highlight four squares around you.
' Wumpus can move a square in any random direction if he sniffs you. You can move first. If he enters pit, you win.

' Bugs:
' if you hold shift down then you can fire in all directions even if you are on your last shot.

SuperStrict
Import BRL.Random

' Toggle for debug mode
Global Debug:Byte = False

' Toggle for cheating
Global Showall:Byte = False

AppTitle:String = "Hunt the Wumpus !"
Global Width:Int = 800, Height:Int = 600, Depth:Int = 0
Graphics Width, Height, Depth
SetBlend ALPHABLEND
SetMaskColor 0, 0, 0
SeedRnd MilliSecs()
FlushKeys

' Players X and Y location on grid.
Global PlayerX:Int, PlayerY:Int = 0, PX:Int = 0, PY:Int = 0
Global WumpusKilled:Byte = False
Global Score:Int = 0 ' Score to be implemented.
Global Level:Int = 0 ' Levels to be implemented.

'Ingame toggles
Global GameOver:Byte = False ' Locks player movement if active because they have died.
Global GameStatus:Int = 0 ' Used to define game over condition eg: 3= left cave with wumpus still alive.
Global Help:Byte = False ' Toggle if help info is displayed in game.

' Playershot location on grid.
Global ShotFired:Byte = False ' If a shot has been fired then area highlighted until next turn.
Global ShotX:Int = 0, ShotY:Int = 0 ' X & Y location of shot square

' Never-ending pit location on grid.
Global PitX:Int = 0, PitY:Int = 0

' Wumpus location on grid.
Global WumpusX:Int, WumpusY:Int = 0

' Annoying bats location on grid.
Global BatsX:Int, BatsY:Int = 0

' Start with 3 arrows and there are a random amount more hidden in one square on grid.
Global NumberofArrows:Int = 0, ArrowX:Int = 0, ArrowY:Int = 0
Global ArrowsCollected:Byte = False

' Exit location on grid
Global ExitX:Int = 0, ExitY:Int = 0, ExitFound:Byte = False

' Message display
Global Message:String = " "
Global Warning:String = " "

' Define 5*5 grid. Could be expanded with a little work.
' Will need to define the grid using Drawtext "#" in a grid size for/next loop if you want different sizes.
Global MaxGridSizeX:Int = 5, MaxGridSizeY:Int = 5 ' Define grid size to make expanding easier later.
Global GridX:Int = 0, GridY:Int = 0
Global GridArray:Int[MaxGridSizeX, MaxGridSizeY]

Init() ' Set up the grid.

Repeat
Display()

If KeyHit(KEY_R)
' Reset the board
Init()
EndIf

If KeyHit(KEY_D)
' Toggle debug mode
If Debug = True
Debug = False
Else
Debug = True
EndIf
EndIf

If KeyHit(KEY_H) ' Display help screen.
If Help = True
Help = False
Message = " "
Else
Help = True
EndIf
EndIf

If KeyHit(KEY_C)
' Toggle if hazzards shown on grid.
If Showall = True
Showall = False
Else
Showall = True
EndIf
EndIf

If KeyHit(KEY_E) ' You can leave the cave alive if you find the exit before dying and are out of ammo.
If PlayerX = ExitX And PlayerY = ExitY
Message = "You leave the cave safely !"
Warning = " "
GameOver = True
GameStatus = 6 ' Exit the cave with Wumpus still alive.
End If
End If

If KeyHit(KEY_A) ' if cheat on then you can press A for 100 arrows - for testing.
If Showall = True
NumberofArrows = 100
EndIf
EndIf

If GameOver = False

If KeyHit(KEY_DOWN) And PlayerY < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY + 1
Fire()
Else
PlayerY:+1
Movement()
EndIf
EndIf

If KeyHit(KEY_UP) And PlayerY > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY - 1
Fire()
Else
PlayerY:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_LEFT) And PlayerX > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX - 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_RIGHT) And PlayerX < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX + 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:+1
Movement()
EndIf
EndIf

Else ' Game Over has been triggered.

If GameStatus = 0 ' Wumpus caught you.
Message = "Roar! The wumpus caught you !"
Warning = "You've been consumed. Yuck !"
WumpusKilled = False
End If

If GameStatus = 2 ' Fell in the pit.
Message = "You fell in the never ending pit."
Warning = "AAAAaaaarrrrggghhh !!!!!"
WumpusKilled = False
End If

If GameStatus = 1 ' Killed the Wumpus.
Message = "Splat! You just nailed that Wumpus !"
Warning = "Well done !"
WumpusKilled = True
EndIf

If GameStatus = 6 ' Exit the cave alive.
WumpusKilled = True
EndIf

If WumpusKilled = False
SetColor 255, 0, 0 ' Red
DrawText "** Game Over ** You were killed !", 250, 100
Else
SetColor 0, 255, 0 ' Green
DrawText "** Well Done ** You won the game !", 250, 100
EndIf

SetColor 0, 100, 200
DrawText "Press 'R' to Restart", 300, 120
EndIf

Flip
Until KeyHit(KEY_ESCAPE)
End

Function Movement()
Local t:Int = 0
Help = False ' Turn off help screen or results of movement will be unknown.
'Message = " "; Warning = " " ' Clear the status displays so player notices new warnings.

If ShotFired = True
ShotFired = False ' Player moved so cancel displaying the shot and remove from grid.
GridArray[ShotX, ShotY] = 0
EndIf

If GridArray[PlayerX, PlayerY] = 0 ' Player in empty square.
Message = "You are searching the cave."
End If

If GridArray[PlayerX, PlayerY] = 4
If ArrowsCollected = False
ArrowsCollected = True
NumberofArrows:+Rand(1, 5)
Message = "Excellent. You found more arrows."
EndIf
EndIf

If GridArray[PlayerX, PlayerY] = 1
GameOver = True
GameStatus = 0 ' Walked into the Wumpus.
EndIf

If GridArray[PlayerX, PlayerY] = 6
ExitFound = True
Message = "Exit found ! Press `E` to Escape."
EndIf

If GridArray[PlayerX, PlayerY] = 2
GameOver = True
GameStatus = 2 ' Fell into the pit
EndIf

If GridArray[PlayerX, PlayerY] = 3
Message = "Bats found you & dropped you somewhere."
t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
EndIf

' ** Check squares adjacent to player because they have moved. **

Warning = " "

If PlayerX > 0 ' Check East.
NearbyHazzard(PlayerX - 1, PlayerY)
EndIf

If PlayerX < 4 ' Check West.
NearbyHazzard(PlayerX + 1, PlayerY)
EndIf

If PlayerY > 0 ' Check North.
NearbyHazzard(PlayerX, PlayerY - 1)
EndIf

If PlayerY < 4 ' Check South
NearbyHazzard(PlayerX, PlayerY + 1)
EndIf

End Function

Function Lights()

' ** Working here ..... **



' Light up each square on grid already visited.
' May want to stop arrows displaying once they have been collected when this is working.

Local x:Int = 0, y:Int = 0
For x = 0 To 4
For y = 0 To 4
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.
Next
Next

End Function

Function NearbyHazzard(xx:Int, yy:Int)

If GridArray[xx, yy] = 1
Warning = "You can hear snoring nearby !"
End If

If GridArray[xx, yy] = 2
Warning = "You can hear your footsteps echo !"
End If

If GridArray[xx, yy] = 3
Warning = "There's squeaking nearby !"
End If

If GridArray[xx, yy] = 6
Warning = "There's a light in the distance !"
End If

End Function

Function Fire()
Local t:Int = gridarray[shotx, shoty]
Help = False ' Turn off help screen or results of shot will be unknown.
If NumberofArrows > 0
NumberofArrows:-1
ShotFired = True
Message = "You fire into empty space !"
If t = 0
GridArray[ShotX, ShotY] = 5
EndIf

If t = 1
GameOver = True ; WumpusKilled = True
GameStatus = 1
End If

If t = 2
Message = "You hear your shot whistle over a pit !"
ShotFired = False
EndIf

If t = 3
Message = "You hear the fluttering of wings !"
ShotFired = False
End If

If t = 4
If ArrowsCollected = False ' if you have collected arrows already then there would be no ricochet.
Message = "Your shot bounced off something !"
ShotFired = False
EndIf
EndIf

If t = 6
Message = "You hear an echo in the distance !"
ShotFired = False
End If

Else
Message = "You are out of ammunition !"
EndIf

End Function

Function Init()

' This is a bit fiddly how I've done the starting locations but it was the best way I could think of ensuring
' each hazzard was on its own square in the grid as it would be useless for the pit and wumpus to be in the
' same place, for example.

' Note it is theoretically possible for the Exit to be located on a square in the corner and a wumpus under it with
' a hole on the side so you could possibly never win. However, having an exit square does mean you could leave the
' cave, so this may not be an issue. If you are going to highlight the squares , when moved over or hazzards located,
' this this could become obvious to the player........

Local t:Byte = 0
GameOver = False
NumberofArrows = 3
ArrowsCollected = False
Warning = " "
ShotFired = False
WumpusKilled = False
ExitFound = False
GameStatus = 0

' Empty the grid so you dont endlessly loop looking for an empty location. Thanks, Jsp.
For t = 0 To 4
GridArray[0, t] = 0
GridArray[1, t] = 0
GridArray[2, t] = 0
GridArray[3, t] = 0
GridArray[4, t] = 0
Next

' Place the Wumpus on grid. [1]
WumpusX = Rand(0, MaxGridSizeX - 1) ; WumpusY = Rand(0, MaxGridSizeY - 1)
GridArray[WumpusX, WumpusY] = 1

' Place the arrows on grid. [4]
Repeat
ArrowX = Rand(0, MaxGridSizeX - 1) ; ArrowY = Rand(0, MaxGridSizeY - 1)
If GridArray[ArrowX, ArrowY] > 0
t = 0
Else
t = 1
GridArray[ArrowX, ArrowY] = 4
EndIf
Until t = 1

' Place the pit on grid. [2]
t = 0
Repeat
PitX = Rand(0, MaxGridSizeX - 1) ; PitY = Rand(0, MaxGridSizeY - 1)
If GridArray[PitX, PitY] > 0
t = 0
Else
t = 1
GridArray[PitX, PitY] = 2
EndIf
Until t = 1

' Place the bats on grid. [3]
t = 0
Repeat
BatsX = Rand(0, MaxGridSizeX - 1) ; BatsY = Rand(0, MaxGridSizeY - 1)

If GridArray[BatsX, BatsY] > 0
t = 0
Else
t = 1
GridArray[BatsX, BatsY] = 3
EndIf
Until t = 1

' Place the exit on grid. [6]
t = 0
Repeat
ExitX = Rand(0, MaxGridSizeX - 1) ; ExitY = Rand(0, MaxGridSizeY - 1)

If GridArray[ExitX, ExitY] > 0
t = 0
Else
t = 1
GridArray[ExitX, ExitY] = 6
EndIf
Until t = 1

' Player to start in a random location.

' This part checks all squares in the grid so the player can be put on a blank one so it won't be instant game over
' if they were deposited on a pit, for example. A similar check is done when the bats move the player.

t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
Movement() ' Updates location message so player has fair warning if hazzard nearby at start.
End Function

Function Display()
Cls
SetColor 100, 100, 255 ' Blue shade
DrawText AppTitle, 45, 10
SetColor 255, 0, 0 ' Red
DrawText "###########################", 0, 30
DrawText "###########################", 0, 40
DrawText "##  ##  ##  ##  ##  ##", 0, 50
DrawText "##  ##  ##  ##  ##  ##", 0, 60
DrawText "##  ##  ##  ##  ##  ##", 0, 70
DrawText "###########################", 0, 80
DrawText "###########################", 0, 90
DrawText "##  ##  ##  ##  ##  ##", 0, 100
DrawText "##  ##  ##  ##  ##  ##", 0, 110
DrawText "##  ##  ##  ##  ##  ##", 0, 120
DrawText "###########################", 0, 130
DrawText "###########################", 0, 140
DrawText "##  ##  ##  ##  ##  ##", 0, 150
DrawText "##  ##  ##  ##  ##  ##", 0, 160
DrawText "##  ##  ##  ##  ##  ##", 0, 170
DrawText "###########################", 0, 180
DrawText "###########################", 0, 190
DrawText "##  ##  ##  ##  ##  ##", 0, 200
DrawText "##  ##  ##  ##  ##  ##", 0, 210
DrawText "##  ##  ##  ##  ##  ##", 0, 220
DrawText "###########################", 0, 230
DrawText "###########################", 0, 240
DrawText "##  ##  ##  ##  ##  ##", 0, 250
DrawText "##  ##  ##  ##  ##  ##", 0, 260
DrawText "##  ##  ##  ##  ##  ##", 0, 270
DrawText "###########################", 0, 280
DrawText "###########################", 0, 290
SetColor 0, 255, 0 ' Green.
DrawText "Arrows remaining: " + NumberofArrows, 40, 310

SetColor 255, 255, 255 ' White.
DrawText "Use cursor keys to move & hold Shift with cursor keys to fire an arrow.", 0, 360

SetColor 0, 255, 0 ' Green
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.

If Exitfound = True Or Showall = True ' if cheating is true or the exit has been located.
SetColor 0, 200, 100 ' ??
DrawText "E", 25 + (ExitX * 40), 60 + (ExitY * 50) ' Draw exit on grid.
EndIf

SetColor 30, 60, 90
DrawText "Created by Tony Brice - Updated June 3rd, 2015 for OSX", 0, 450

If Help = True
SetColor 0, 255, 200
DrawText "Harry the Hunter, is on the hunt.", 235, 50
DrawText "A few arrows and his trusty bow", 235, 70
DrawText "are all he needs to kill that nasty,", 235, 80
DrawText "smelly Wumpus but be cautious as", 235, 90
DrawText "there are some deadly hazzards in this", 235, 100
DrawText "cave that are really bad for your", 235, 110
DrawText "health...", 235, 120
DrawText "Run out of Ammo? Then look for", 235, 140
DrawText "the exit.", 235, 150
DrawText "Watch out for important messages ", 235, 170
DrawText "as you move around. They may just ", 235, 180
DrawText "save your life...", 235, 190
Else
SetColor 255, 255, 255
DrawText "Messages: ", 235, 30
DrawText "Warning: ", 235, 50
DrawText Message, 320, 30
SetColor 255, 0, 0 ' Red
DrawText Warning, 320, 50
SetColor 255, 255, 255 ' White
End If

If Debug = True
SetColor 255, 0, 255 ' Pink.
DrawText "Debug mode is on:", 0, 400
DrawText "X: " + MouseX() + " Y: " + MouseY(), 145, 400
PX = PlayerX + 1 ; PY = PlayerY + 1
DrawText "Player location : X=" + PX + " , Y=" + PY, 0, 410
DrawText "/ Exit located: ", 225, 410
If ExitFound = True
DrawText "Yes", 350, 410
Else
DrawText "No", 350, 410
EndIf
DrawText "Arrows collected: ", 0, 420
If ArrowsCollected = True
DrawText "Yes", 145, 420
Else
DrawText "No", 145, 420
EndIf
SetColor 255, 255, 255 ' White
DrawText "R to Reset / H for help / Esc to exit / C to cheat.", 0, 350
Else
DrawText "R to Reset / H for help / Esc to exit.", 0, 350
EndIf

If ShotFired = True
' Show where a shot has been fired if active.
SetColor 255, 0, 0 ' Red
DrawText "%", 25 + (ShotX * 40), 60 + (ShotY * 50)
EndIf

If Showall = True
' Cheat mode toggled by pressing "C"
SetColor 255, 0, 0 ' Red.
DrawText "Player is Cheating", 45, 330
SetColor 0, 255, 255 ' Cyan
DrawText "W", 25 + (WumpusX * 40), 60 + (WumpusY * 50)
SetColor 100, 100, 100 ' Grey
DrawText "H", 25 + (PitX * 40), 60 + (PitY * 50)
SetColor 100, 200, 100 ' Dull green
DrawText "B", 25 + (BatsX * 40), 60 + (BatsY * 50)
SetColor 0, 0, 255 ' Blue
DrawText "^", 25 + (ArrowX * 40), 60 + (ArrowY * 50)
EndIf

EndFunction

Thats totally sweet man! Imagine what you could had achieved without the hangover muhaha.. :)
>

RemiD

#11
i have started programming in php+html+css+javascript, for the web in 2008, in order to create small websites to describe and market and sell ebooks.

i have always played video games during the winter months, and someday i started to make mods for the game 'morrowind', but it was too limiting, so i decided to search 'how to make a video game'.

at the time, the 2 choices (for my beginner level) were darkbasic and blitsbasic/blitz3d, and after some experiments i decided to continue with blitzbasic/blitz3d (in 2009).

since then i have continued to use blitzbasic/blitz3d to learn concepts about programming and making video games, and to create tools and little games...

these days i am interested in javascript to create web games which would work with crypto currencies...

RemiD

Quote from: Dabz on March 11, 2025, 07:24:21*Pause in programming due to discovery of Merrydowne cider and, erm, hormones)*
lmao  :))

Xerra

Quote from: Alienhead on March 12, 2025, 19:19:30
Quote from: Xerra on March 12, 2025, 16:47:46
Quote from: Alienhead on March 11, 2025, 23:11:45I'll show my age..  I started with my folks hand me down TI-99/4a ( texas instruments ) from service merchandise.
I feel in love with computers after that experience at a ripe age of 7. lol.  I remember getting a monthly TI magazine in the mail and in the center they always had a 3 to 4 pages of code I had to type in to play the game of the month.  Had to save it to a tape recorder ! hehe.. Ahh those were the days.. Hunt the Wompus !  But believe it or not, after typing those games in from the magazine over a few years, I didnt realize it but I learned how to code, even though it was BASIC. but was a strong foundation I suppose.


This gave me an excuse to dust off the old storage drive on my desk and dig out my version of Hunt the Wumpus that I wrote back in 2014 in Blitzmax. I did it on New Years Day as well - complete with hangover. This was based on how the original game worked, except my map was more linear as I couldn't get my head round the hexagon-based original version at the time. I totally blame Carlsberg for that one.

As it's written with no custom graphics or sound, here's the complete source code for you nostalgic lot. Same code that I posted in the old BM forums back in the day. IwasAdam might remember, as he played around with it a bit, as I recall.

' Hunt the Wumpus by Tony Brice - January, 2014.
' Modified for OSX June 3, 2015.

' To Do:

' Light up all squares already moved over.
'
' Ideas:
' Expand grid size to 10 * 10 & adjust arrows, hazzards accordingly.
' Message box set up as a scrolling area of message text which can move up screen as new info displayed.
' Score system for number of Wumpus tracked and killed before dying. Could add 10 points each square moved or similar.
' Implement a torch that you can use once to highlight four squares around you.
' Wumpus can move a square in any random direction if he sniffs you. You can move first. If he enters pit, you win.

' Bugs:
' if you hold shift down then you can fire in all directions even if you are on your last shot.

SuperStrict
Import BRL.Random

' Toggle for debug mode
Global Debug:Byte = False

' Toggle for cheating
Global Showall:Byte = False

AppTitle:String = "Hunt the Wumpus !"
Global Width:Int = 800, Height:Int = 600, Depth:Int = 0
Graphics Width, Height, Depth
SetBlend ALPHABLEND
SetMaskColor 0, 0, 0
SeedRnd MilliSecs()
FlushKeys

' Players X and Y location on grid.
Global PlayerX:Int, PlayerY:Int = 0, PX:Int = 0, PY:Int = 0
Global WumpusKilled:Byte = False
Global Score:Int = 0 ' Score to be implemented.
Global Level:Int = 0 ' Levels to be implemented.

'Ingame toggles
Global GameOver:Byte = False ' Locks player movement if active because they have died.
Global GameStatus:Int = 0 ' Used to define game over condition eg: 3= left cave with wumpus still alive.
Global Help:Byte = False ' Toggle if help info is displayed in game.

' Playershot location on grid.
Global ShotFired:Byte = False ' If a shot has been fired then area highlighted until next turn.
Global ShotX:Int = 0, ShotY:Int = 0 ' X & Y location of shot square

' Never-ending pit location on grid.
Global PitX:Int = 0, PitY:Int = 0

' Wumpus location on grid.
Global WumpusX:Int, WumpusY:Int = 0

' Annoying bats location on grid.
Global BatsX:Int, BatsY:Int = 0

' Start with 3 arrows and there are a random amount more hidden in one square on grid.
Global NumberofArrows:Int = 0, ArrowX:Int = 0, ArrowY:Int = 0
Global ArrowsCollected:Byte = False

' Exit location on grid
Global ExitX:Int = 0, ExitY:Int = 0, ExitFound:Byte = False

' Message display
Global Message:String = " "
Global Warning:String = " "

' Define 5*5 grid. Could be expanded with a little work.
' Will need to define the grid using Drawtext "#" in a grid size for/next loop if you want different sizes.
Global MaxGridSizeX:Int = 5, MaxGridSizeY:Int = 5 ' Define grid size to make expanding easier later.
Global GridX:Int = 0, GridY:Int = 0
Global GridArray:Int[MaxGridSizeX, MaxGridSizeY]

Init() ' Set up the grid.

Repeat
Display()

If KeyHit(KEY_R)
' Reset the board
Init()
EndIf

If KeyHit(KEY_D)
' Toggle debug mode
If Debug = True
Debug = False
Else
Debug = True
EndIf
EndIf

If KeyHit(KEY_H) ' Display help screen.
If Help = True
Help = False
Message = " "
Else
Help = True
EndIf
EndIf

If KeyHit(KEY_C)
' Toggle if hazzards shown on grid.
If Showall = True
Showall = False
Else
Showall = True
EndIf
EndIf

If KeyHit(KEY_E) ' You can leave the cave alive if you find the exit before dying and are out of ammo.
If PlayerX = ExitX And PlayerY = ExitY
Message = "You leave the cave safely !"
Warning = " "
GameOver = True
GameStatus = 6 ' Exit the cave with Wumpus still alive.
End If
End If

If KeyHit(KEY_A) ' if cheat on then you can press A for 100 arrows - for testing.
If Showall = True
NumberofArrows = 100
EndIf
EndIf

If GameOver = False

If KeyHit(KEY_DOWN) And PlayerY < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY + 1
Fire()
Else
PlayerY:+1
Movement()
EndIf
EndIf

If KeyHit(KEY_UP) And PlayerY > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX ; ShotY = PlayerY - 1
Fire()
Else
PlayerY:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_LEFT) And PlayerX > 0
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX - 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:-1
Movement()
EndIf
EndIf

If KeyHit(KEY_RIGHT) And PlayerX < 4
If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT)
ShotX = PlayerX + 1 ; ShotY = PlayerY
Fire()
Else
PlayerX:+1
Movement()
EndIf
EndIf

Else ' Game Over has been triggered.

If GameStatus = 0 ' Wumpus caught you.
Message = "Roar! The wumpus caught you !"
Warning = "You've been consumed. Yuck !"
WumpusKilled = False
End If

If GameStatus = 2 ' Fell in the pit.
Message = "You fell in the never ending pit."
Warning = "AAAAaaaarrrrggghhh !!!!!"
WumpusKilled = False
End If

If GameStatus = 1 ' Killed the Wumpus.
Message = "Splat! You just nailed that Wumpus !"
Warning = "Well done !"
WumpusKilled = True
EndIf

If GameStatus = 6 ' Exit the cave alive.
WumpusKilled = True
EndIf

If WumpusKilled = False
SetColor 255, 0, 0 ' Red
DrawText "** Game Over ** You were killed !", 250, 100
Else
SetColor 0, 255, 0 ' Green
DrawText "** Well Done ** You won the game !", 250, 100
EndIf

SetColor 0, 100, 200
DrawText "Press 'R' to Restart", 300, 120
EndIf

Flip
Until KeyHit(KEY_ESCAPE)
End

Function Movement()
Local t:Int = 0
Help = False ' Turn off help screen or results of movement will be unknown.
'Message = " "; Warning = " " ' Clear the status displays so player notices new warnings.

If ShotFired = True
ShotFired = False ' Player moved so cancel displaying the shot and remove from grid.
GridArray[ShotX, ShotY] = 0
EndIf

If GridArray[PlayerX, PlayerY] = 0 ' Player in empty square.
Message = "You are searching the cave."
End If

If GridArray[PlayerX, PlayerY] = 4
If ArrowsCollected = False
ArrowsCollected = True
NumberofArrows:+Rand(1, 5)
Message = "Excellent. You found more arrows."
EndIf
EndIf

If GridArray[PlayerX, PlayerY] = 1
GameOver = True
GameStatus = 0 ' Walked into the Wumpus.
EndIf

If GridArray[PlayerX, PlayerY] = 6
ExitFound = True
Message = "Exit found ! Press `E` to Escape."
EndIf

If GridArray[PlayerX, PlayerY] = 2
GameOver = True
GameStatus = 2 ' Fell into the pit
EndIf

If GridArray[PlayerX, PlayerY] = 3
Message = "Bats found you & dropped you somewhere."
t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
EndIf

' ** Check squares adjacent to player because they have moved. **

Warning = " "

If PlayerX > 0 ' Check East.
NearbyHazzard(PlayerX - 1, PlayerY)
EndIf

If PlayerX < 4 ' Check West.
NearbyHazzard(PlayerX + 1, PlayerY)
EndIf

If PlayerY > 0 ' Check North.
NearbyHazzard(PlayerX, PlayerY - 1)
EndIf

If PlayerY < 4 ' Check South
NearbyHazzard(PlayerX, PlayerY + 1)
EndIf

End Function

Function Lights()

' ** Working here ..... **



' Light up each square on grid already visited.
' May want to stop arrows displaying once they have been collected when this is working.

Local x:Int = 0, y:Int = 0
For x = 0 To 4
For y = 0 To 4
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.
Next
Next

End Function

Function NearbyHazzard(xx:Int, yy:Int)

If GridArray[xx, yy] = 1
Warning = "You can hear snoring nearby !"
End If

If GridArray[xx, yy] = 2
Warning = "You can hear your footsteps echo !"
End If

If GridArray[xx, yy] = 3
Warning = "There's squeaking nearby !"
End If

If GridArray[xx, yy] = 6
Warning = "There's a light in the distance !"
End If

End Function

Function Fire()
Local t:Int = gridarray[shotx, shoty]
Help = False ' Turn off help screen or results of shot will be unknown.
If NumberofArrows > 0
NumberofArrows:-1
ShotFired = True
Message = "You fire into empty space !"
If t = 0
GridArray[ShotX, ShotY] = 5
EndIf

If t = 1
GameOver = True ; WumpusKilled = True
GameStatus = 1
End If

If t = 2
Message = "You hear your shot whistle over a pit !"
ShotFired = False
EndIf

If t = 3
Message = "You hear the fluttering of wings !"
ShotFired = False
End If

If t = 4
If ArrowsCollected = False ' if you have collected arrows already then there would be no ricochet.
Message = "Your shot bounced off something !"
ShotFired = False
EndIf
EndIf

If t = 6
Message = "You hear an echo in the distance !"
ShotFired = False
End If

Else
Message = "You are out of ammunition !"
EndIf

End Function

Function Init()

' This is a bit fiddly how I've done the starting locations but it was the best way I could think of ensuring
' each hazzard was on its own square in the grid as it would be useless for the pit and wumpus to be in the
' same place, for example.

' Note it is theoretically possible for the Exit to be located on a square in the corner and a wumpus under it with
' a hole on the side so you could possibly never win. However, having an exit square does mean you could leave the
' cave, so this may not be an issue. If you are going to highlight the squares , when moved over or hazzards located,
' this this could become obvious to the player........

Local t:Byte = 0
GameOver = False
NumberofArrows = 3
ArrowsCollected = False
Warning = " "
ShotFired = False
WumpusKilled = False
ExitFound = False
GameStatus = 0

' Empty the grid so you dont endlessly loop looking for an empty location. Thanks, Jsp.
For t = 0 To 4
GridArray[0, t] = 0
GridArray[1, t] = 0
GridArray[2, t] = 0
GridArray[3, t] = 0
GridArray[4, t] = 0
Next

' Place the Wumpus on grid. [1]
WumpusX = Rand(0, MaxGridSizeX - 1) ; WumpusY = Rand(0, MaxGridSizeY - 1)
GridArray[WumpusX, WumpusY] = 1

' Place the arrows on grid. [4]
Repeat
ArrowX = Rand(0, MaxGridSizeX - 1) ; ArrowY = Rand(0, MaxGridSizeY - 1)
If GridArray[ArrowX, ArrowY] > 0
t = 0
Else
t = 1
GridArray[ArrowX, ArrowY] = 4
EndIf
Until t = 1

' Place the pit on grid. [2]
t = 0
Repeat
PitX = Rand(0, MaxGridSizeX - 1) ; PitY = Rand(0, MaxGridSizeY - 1)
If GridArray[PitX, PitY] > 0
t = 0
Else
t = 1
GridArray[PitX, PitY] = 2
EndIf
Until t = 1

' Place the bats on grid. [3]
t = 0
Repeat
BatsX = Rand(0, MaxGridSizeX - 1) ; BatsY = Rand(0, MaxGridSizeY - 1)

If GridArray[BatsX, BatsY] > 0
t = 0
Else
t = 1
GridArray[BatsX, BatsY] = 3
EndIf
Until t = 1

' Place the exit on grid. [6]
t = 0
Repeat
ExitX = Rand(0, MaxGridSizeX - 1) ; ExitY = Rand(0, MaxGridSizeY - 1)

If GridArray[ExitX, ExitY] > 0
t = 0
Else
t = 1
GridArray[ExitX, ExitY] = 6
EndIf
Until t = 1

' Player to start in a random location.

' This part checks all squares in the grid so the player can be put on a blank one so it won't be instant game over
' if they were deposited on a pit, for example. A similar check is done when the bats move the player.

t = 0
Repeat
PlayerX = Rand(0, 4) ; PlayerY = Rand(0, 4)
If GridArray[PlayerX, PlayerY] = 0
t = 1
Else
t = 0
EndIf
Until t = 1
Movement() ' Updates location message so player has fair warning if hazzard nearby at start.
End Function

Function Display()
Cls
SetColor 100, 100, 255 ' Blue shade
DrawText AppTitle, 45, 10
SetColor 255, 0, 0 ' Red
DrawText "###########################", 0, 30
DrawText "###########################", 0, 40
DrawText "##  ##  ##  ##  ##  ##", 0, 50
DrawText "##  ##  ##  ##  ##  ##", 0, 60
DrawText "##  ##  ##  ##  ##  ##", 0, 70
DrawText "###########################", 0, 80
DrawText "###########################", 0, 90
DrawText "##  ##  ##  ##  ##  ##", 0, 100
DrawText "##  ##  ##  ##  ##  ##", 0, 110
DrawText "##  ##  ##  ##  ##  ##", 0, 120
DrawText "###########################", 0, 130
DrawText "###########################", 0, 140
DrawText "##  ##  ##  ##  ##  ##", 0, 150
DrawText "##  ##  ##  ##  ##  ##", 0, 160
DrawText "##  ##  ##  ##  ##  ##", 0, 170
DrawText "###########################", 0, 180
DrawText "###########################", 0, 190
DrawText "##  ##  ##  ##  ##  ##", 0, 200
DrawText "##  ##  ##  ##  ##  ##", 0, 210
DrawText "##  ##  ##  ##  ##  ##", 0, 220
DrawText "###########################", 0, 230
DrawText "###########################", 0, 240
DrawText "##  ##  ##  ##  ##  ##", 0, 250
DrawText "##  ##  ##  ##  ##  ##", 0, 260
DrawText "##  ##  ##  ##  ##  ##", 0, 270
DrawText "###########################", 0, 280
DrawText "###########################", 0, 290
SetColor 0, 255, 0 ' Green.
DrawText "Arrows remaining: " + NumberofArrows, 40, 310

SetColor 255, 255, 255 ' White.
DrawText "Use cursor keys to move & hold Shift with cursor keys to fire an arrow.", 0, 360

SetColor 0, 255, 0 ' Green
DrawText "@", 25 + (PlayerX * 40), 60 + (PlayerY * 50) ' Draw player on grid.

If Exitfound = True Or Showall = True ' if cheating is true or the exit has been located.
SetColor 0, 200, 100 ' ??
DrawText "E", 25 + (ExitX * 40), 60 + (ExitY * 50) ' Draw exit on grid.
EndIf

SetColor 30, 60, 90
DrawText "Created by Tony Brice - Updated June 3rd, 2015 for OSX", 0, 450

If Help = True
SetColor 0, 255, 200
DrawText "Harry the Hunter, is on the hunt.", 235, 50
DrawText "A few arrows and his trusty bow", 235, 70
DrawText "are all he needs to kill that nasty,", 235, 80
DrawText "smelly Wumpus but be cautious as", 235, 90
DrawText "there are some deadly hazzards in this", 235, 100
DrawText "cave that are really bad for your", 235, 110
DrawText "health...", 235, 120
DrawText "Run out of Ammo? Then look for", 235, 140
DrawText "the exit.", 235, 150
DrawText "Watch out for important messages ", 235, 170
DrawText "as you move around. They may just ", 235, 180
DrawText "save your life...", 235, 190
Else
SetColor 255, 255, 255
DrawText "Messages: ", 235, 30
DrawText "Warning: ", 235, 50
DrawText Message, 320, 30
SetColor 255, 0, 0 ' Red
DrawText Warning, 320, 50
SetColor 255, 255, 255 ' White
End If

If Debug = True
SetColor 255, 0, 255 ' Pink.
DrawText "Debug mode is on:", 0, 400
DrawText "X: " + MouseX() + " Y: " + MouseY(), 145, 400
PX = PlayerX + 1 ; PY = PlayerY + 1
DrawText "Player location : X=" + PX + " , Y=" + PY, 0, 410
DrawText "/ Exit located: ", 225, 410
If ExitFound = True
DrawText "Yes", 350, 410
Else
DrawText "No", 350, 410
EndIf
DrawText "Arrows collected: ", 0, 420
If ArrowsCollected = True
DrawText "Yes", 145, 420
Else
DrawText "No", 145, 420
EndIf
SetColor 255, 255, 255 ' White
DrawText "R to Reset / H for help / Esc to exit / C to cheat.", 0, 350
Else
DrawText "R to Reset / H for help / Esc to exit.", 0, 350
EndIf

If ShotFired = True
' Show where a shot has been fired if active.
SetColor 255, 0, 0 ' Red
DrawText "%", 25 + (ShotX * 40), 60 + (ShotY * 50)
EndIf

If Showall = True
' Cheat mode toggled by pressing "C"
SetColor 255, 0, 0 ' Red.
DrawText "Player is Cheating", 45, 330
SetColor 0, 255, 255 ' Cyan
DrawText "W", 25 + (WumpusX * 40), 60 + (WumpusY * 50)
SetColor 100, 100, 100 ' Grey
DrawText "H", 25 + (PitX * 40), 60 + (PitY * 50)
SetColor 100, 200, 100 ' Dull green
DrawText "B", 25 + (BatsX * 40), 60 + (BatsY * 50)
SetColor 0, 0, 255 ' Blue
DrawText "^", 25 + (ArrowX * 40), 60 + (ArrowY * 50)
EndIf

EndFunction

Thats totally sweet man! Imagine what you could had achieved without the hangover muhaha.. :)
>
I've looked through that code a bit since I originally posted it. It's a pretty bloated and poor bit of work, if I'm honest. I could have done it better in half the lines and much improved these days. 
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/revenge-of-the-quadra
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

PixelOutlaw

Quote from: Xerra on March 14, 2025, 16:43:44I've looked through that code a bit since I originally posted it. It's a pretty bloated and poor bit of work, if I'm honest. I could have done it better in half the lines and much improved these days.

Well it's a reflection of the times. :)
One DEFUN to rule them all, One DEFUN to find them, One DEFUN to RETURN them all, and in the darkness MULTIPLE-VALUE-BIND them.