Simon a simple remember the sequence game

Simontelescopium

Member
Licensed User
How good an application can you make in only 100 lines of B4PPC code?
Here is my attempt of a ‘Simon’ © type game from the ‘80’s.

I started writing this as an exercise and halfway through decided to challenge myself to write it in just 100 lines, I went over by 4 lines:sign0148:, see what you think… Please forgive the non-existent error checking and lack of sympathy for wide screed devices :-(

Features include buttons that light up and sounds! - all in 100 lines (almost)

How good an application or game can you make in 100 lines?
 

Attachments

  • ScreenShot058.jpg
    ScreenShot058.jpg
    9.6 KB · Views: 317
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Very nice!

One small thing:
B4X:
Dim ControlNo(0) As Byte
You should declare the array as a String array (or do not declare the type at all).
As of the next version you will get an error if you try to convert an array type and this actually happens in this line:
B4X:
ControlNo() = StrSplit(Sender.Name,"n")
Because StrSplit returns a String array.
 

Simontelescopium

Member
Licensed User
ok thanks for the tip.
I have also noticed that the short mp3 files don't play on the device - not even in media player! but work fine on the desktop, so I converted to WAV and found these short files also have difficulty playing - the problem this time appears to be the speaker on my HTC touch HD which doesn't seem to reproduce pure tones that well (just get white noise seems to be sounds below 500hz) - works better with the headphones in :)

So once I have generated all the WAV files I'll ditch FMOD and mp3's - makes the program size smaller :)

Is there any way to compile the sound files into the exe i.e. an image list equivalent for sound files?
 
Last edited:
Hello Simon.
You deserve an award for uploading such nice applications. :)
Me ... I'm still a noob and have a lot to learn in programming.I have tried to rewrite your app (as a self-drill) in a simpler way.Attached is what I have been able to pull off.:).....
My app aint working right.If the player presses a button when userInput is supposed to be false there is no message box displayed and the sequence gets erratic, and when the player presses the wrong button msgbox("Bad luck") is not always displayed.
Yesterday I spent hours trying to sort the aforementioned out, but in vain.:sign0161:
I assume it's not a big trouble for you or for some other expert to check my code and point out the bug.I will appreciate such an effort.

Also I thought of using wav files instead of mp3 as fmodCE seems to have disappeared from that site.But i failed to find any proper sounds for this game.
So any refference to a good wav source will be very welcome.

Thank you.
Nicolas.
 

Simontelescopium

Member
Licensed User
The code seems to work for me... What might be happening is you are using the keyword 'sleep' to control the pace of the game, i think these halt the program entirely using the timers you can still react to user input while still controling the pace.


I have added some levels (different numbers of buttons) some scoring and sounds, source available here...http://itslifejim.wikispaces.com/files
I grew bored of this application so am not developing in any further feel free to use and abuse the code/ sound files etc.

Simon.
 
Top