Jump to content

Looking for help Guess game

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
flawkstawker

flawkstawker

    Newbie

  • Members
  • Pip
  • 3 posts
OK so I'm pretty new to programming and I have made only a few basic programs so far with out too much trouble. The one I'm working on now is giving me trouble though. I have no clue how to make it so i can reset my guess game. I have attached my code in a .txt file any help or tips on design would be awesome.

Attached Files



#2
flawkstawker

flawkstawker

    Newbie

  • Members
  • Pip
  • 3 posts
this is code not in a file
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < score.Length; i++)
score[i] = r.Next(10) + 1;// sets random array values.

}
int[] score = new int[2];// made 2 ints in the array on purpose so I can complicate the game later + practice in declaring.

Random r = new Random();// only way i know how to make a random set of numbers.






private void button1_Click(object sender, EventArgs e)
{


int textBox = int.Parse(textBox1.Text);
if (textBox > score[0])
MessageBox.Show("too high");
else MessageBox.Show("No");// there will be more conditions later after Current problem is solved. Would it be better to use a switch statement?
}

private void Form1_Load(object sender, EventArgs e)// not sure how or why this is hear.
{

}

private void button2_Click(object sender, EventArgs e)//maybe for score to or a reset button
{

}
}
}

#3
jwxie518

jwxie518

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,180 posts
i am a newbie but i would like to ask you a question, so other experts may jump in and get interested.

what kind of guess game? what is the rule?
and plus, as time goes on, my skill improves, i can code a similar program on my own so i can see how well my level will be
and also will help others too :]

#4
flawkstawker

flawkstawker

    Newbie

  • Members
  • Pip
  • 3 posts
essentially this game makes a random number (actually 2 but im not using the one yet) 1- 10 and based on the users guess/input it will show a hint or tell you that you got it right. Kinda like a hot cold guessing game.