Hey guys, I'm finished school and I set myself a personal project to make a game in Delphi 6.

Some of my friends who are still in school [yr12] in ipt are doing an assignment where they have to make a game and I thought I'd test out myself and see if I could remember how to do it haha!


I must use an array and record during this project.
My goal is to create a code cracking game in which a random code is generated and the user must guess it [having only 10, 15, 20 attempts depending on difficulty].

I have succesfully made a username option which gets saved to a text file. But i need some serious help programming wise...

The form looks like this - http://img340.imageshack.us/img340/7417/yupyf5.jpg


So my problems I need help with are:
-using the array and record somewhere in it
-Creating a random code for the user to guess[using randomize I'd assume]
-When the user guesses incorrectly, the "cross" is shown, if it is correct a "tick" is shown and the number displayed in the box [using the visibility options I also assume]
-a list of sequences they've already tried is added somewhere [so when they click the crack it button it adds their current input into a memobox or something which will be displayed somewhere on the form]

-And for brownie points it'd be great to be able to have another form which showed how many guesses it took the person, their time it took them, and a comparison between them and other people who have used the program would also be a handy add on I think.


Any help for this forgetful delphi man would be much appreciated.


Thank you.

Ok im starting to make some progress.

Now I need to make an array which just holds 4 numbers which are randomly created when a CrackIt button is pressed. I was thinking something like

NumArray : array[1..4] of Integer;

begin
Randomize;
NumArray[1..4]:= // Can it be assigned to "Random" or Randomize or something?

If I can get that to work, after the user inputs their guess I was thinking something along the lines of.


begin

TurnsLeft:=Turnsleft-1

if edtNum1=Numarray[1] then // Find out if the value in the first text box equals the random number assigned to Numarray[1]
imgTick1.visible =true; //the tick is shown
else
imgCross1.visible=true // cross is shown


But I also would need to check for edtNum2 to edtnum4.

Is this able to be done just by using if then else?

As far as the assigning random numbers to the array, what if I did like:

Begin

Randomize;
For Numarray:= 1 to 4 DO
begin
Numarray:= Random(10)
end

As far as the assigning random numbers to the array, what if I did like:

Begin

Randomize;
For Numarray:= 1 to 4 DO
begin
Numarray:= Random(10)
end

i'm using delphi 5 and i worked a lot with Pascal but that piece of code CAN'T WORK.

my friend, do you have the elementary basics? before you start to fall in love with delphi(drag&drop) you must learn some basics of programming, you must know pseudocode which is the bottom of programming.

i can write you some code but i don't think that will help you so try to code what's bellow

randomize
with your_array take a random value

and when you'll post again please be more explicitly.

best regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.