I created a program that picks a champion for a role on the game League of Legends using arrays and random numbers.
Is there a quicker and more efficient way of doing this?
There is one form that contains this:
namespace Random_Champ_Picker_V2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
internal void button1_Click( object sender, EventArgs e )
{
arrays array = new arrays();
if( radioButton1.Checked == true )
{
Random T = new Random();
int t = T.Next( 0, 57 );
string toop = (string) array.top.GetValue( t );
textBox1.Text = toop;
}
else if( radioButton2.Checked == true )
{
Random T = new Random();
int t = T.Next( 0, 38 );
string toop = (string) array.jung.GetValue( t );
textBox1.Text = toop;
}
else if( radioButton3.Checked == true )
{
Random T = new Random();
int t = T.Next( 0, 41 );
string toop = (string) array.mid.GetValue( t );
textBox1.Text = toop;
}
else if( radioButton4.Checked == true )
{
Random T = new Random();
int t = T.Next( 0, 15 );
string toop = (string) array.marksmen.GetValue( t );
textBox1.Text = toop;
}
else if( radioButton5.Checked == true )
{
Random T = new Random();
int t = T.Next( 0, 18 );
string toop = (string) array.supp.GetValue( t );
textBox1.Text = toop;
}
}
Class that contains the arrays (I removed most champ names for this post not to be cluttered):
namespace Random_Champ_Picker_V2
{
internal class arrays
{
internal string[] supp = new string[] {"Taric","Thresh"};
internal string[] marksmen = new string[]{"Ezreal","Ashe"};
internal string[] top = new string[]{"Zac","Aatrox"};
internal string[] jung = new string[]{"Amumu","Jarvan IV"};
internal string[] mid = new string[]{"karma","ziggs"};
}
}
'Orianna'
all the time as she is clearly the master champion here. On a more serious, but off-topic, note - are you trying to make an Ultimate Bravery program? :) \$\endgroup\$