1.

Solve : Who Want's to be a... Billionaire...??

Answer»

Quote from: CBMatt on December 10, 2008, 08:21:07 PM

Hmm, I tried running it in a sandboxed environment, but it stopped responding. You feel like giving it a shot, Carbon? (Despite your previous response... Heh.)
I'll try it on my old unused laptop later if I remember. Looks like all it downloads is the .NET FRAMEWORK 3.5 SP1 (if you don't already have it installed). I can't get the game to work properly for me, but so far, it doesn't appear to have any malicious signatures or activities. It should be okay for anyone to try it out if they wish to do so. Of course, everyone should always exercise caution when downloading unfamiliar files. Everything has come back clean, but you can never be 100% certain, so download at your own discretion.Quote from: Carbon Dudeoxide on December 10, 2008, 08:53:43 PM
...if I remember.

Do remember. Anyone with VB08 with SP1 and really cares, here is the source. (Code is a bit bloated, i know. I'm working on it [2077 lines])

http://www.mediafire.com/download.php?cnywizmgkltYaay! I have trust with evidence! =P

Sorry, had to.

Sorry for the double-post BTW.Quote from: Artimis.Rules on December 10, 2008, 08:58:43 PM
Do remember. Anyone with VB08 with SP1 and really cares, here is the source. (Code is a bit bloated, i know. I'm working on it [2077 lines])


Visual Studio Professional '08...

I'll take a gander when I'm bored. might have suggestions... if you're open to them.

Alright, took a quick look see at yer code; got some tips for you.


First; the four buttons appear to run the same code, but in four different places (Click events)

I recommend creating a separate procedure- for example, "CheckAnswer", which will take A,B,C, or D as it's argument.

then, each of your four buttons will be one line; "CheckAnswer("A")" for button A, and so forth. I could hazard a guess and say you've never used separate subroutines, which is OK, but they make programming a lot easier, and you can never learn them too early.


Also; you've got no error handling code. While this is acceptable for a Alpha or beta, it never hurts; and you can never add, (or learn how to write) them too early.


For example, in Button2_Click, where you open the text file whose name resides in textbox2 (love your imaginative names, btw ) the readAlllines() call could easily fail; rather then have your game crash with a generic framework error, you could enclose the procedure code in Try...Catch Block, and then provide a more descriptive error to your users. I'd be more specific, but I'd Rather be accurate then dead wrong, and I'm far more experienced with VB6 then .NET... In fact I almost suggested the use of an "On Error" statement, but that doesn't EXIST in .NET, and if it does it was deprecated by try...catch.

Last critique would be to rename your controls. I happened under the same problem when I learned VB way back with Visual basic 2 on Windows 3.1; I simply used the default names. Nowadays I wonder why it even provides a default name... under how many circumstances does the name "Command1" or "Text1" describe the controls purpose? Not often, I'm sure. Even today, over 15 years later, the default behaviour for control naming is exactly the same as it was in 1991. On the up-side, they actually changed the menu editor after VB6 (although they changed pretty much everything and it only stood to reason that they would also revamp the 15 year old menu editor)

lastly- your use of the "lines()" array seems a but non-linear; from what I can gather, it contains the various questions. a more extensible method would be to use a integral variable to store your question number; them multiply that question number by 7(number of lines in each questions definition), and add 1 (the introduction question); this will give you the first line (hopefully) for the question; you can then add the numbers 1 through 6 to EXTRACT the various portions of the questions data.



I'd add some more positive stuff here, but I think my years of experience makes me a bit blind to what I used to think was neat and cool years ago. In any case, I commend your efforts


On the part about my code being bloated -- I know. Been working on it. Like this?:

Code: [Select]If qnum = "1" Then
readline = lines(6)
If readline = "a" And correctanswer = "a" Or readline = "b" And correctanswer = "b" Or readline = "c" And correctanswer = "c" Or readline = "d" And correctanswer = "d" Then
MsgBox("CORRECT!")
'Question
readline = lines(8)
Question.Text = readline
'AnsA
readline = lines(9)
AnsA.Text = readline
'AnsB
readline = lines(10)
AnsB.Text = readline
'AnsC
readline = lines(11)
AnsC.Text = readline
'AnsD
readline = lines(12)
AnsD.Text = readline
qnum = "2"
Timer1.Enabled = True
correctanswer = lines(13)
Else
MsgBox("INCORRECT!")
qnum = "start"
readline = lines(0)
Question.Text = readline
AnsA.Text = "Yes"
AnsB.Text = "No"
AnsC.Visible = False
AnsD.Visible = False
End If
End If



If qnum = "start" Then
AnsC.Visible = True
AnsD.Visible = True
'Question
readline = lines(1)
Question.Text = readline
'AnsA
readline = lines(2)
AnsA.Text = readline
'AnsB
readline = lines(3)
AnsB.Text = readline
'AnsC
readline = lines(4)
AnsC.Text = readline
'AnsD
readline = lines(5)
AnsD.Text = readline
qnum = "1"
correctanswer = lines(6)
End If
If Question.Text = "end" Then
MsgBox("Congradulations! You have completed this version of 'Who Wants to Be a Billionaire?'!")
qnum = "start"
readline = lines(0)
Question.Text = readline
AnsA.Text = "Yes"
AnsB.Text = "No"
AnsC.Visible = False
AnsD.Visible = False
End If
I know about renaming the commands and such -- Those few controls we're my most recent addition... and aren't exactly up-to-par yet

The rest was like a toothpick against a BRICK WALL. Not sure what you said lol.

EDIT: Going to start a new VB Project, copy the basic parts of code and the objects into it, then re-work the "Answer selection, checking, and changing question"-part


Discussion

No Comment Found