I am a beginner at C#. I am trying to deal equal amounts of cards to 2 players in a card game. I have to divide my array( of cards ) into two so that each player will have the same amount of cards. I have already made use of my GetImages()
to randomize ALL(which is all 40) images into 1 pictureBox
. So next I will have to split it into two and put them into the pictureBox
when my Form loads.
Any help will be much appreciated, thanks.
Here is my code:
public string[] GetImages(){
string[] img = new string[40];
img[0] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\1.png";
img[1] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\2.png";
img[2] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\3.png";
img[3] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\5.png";
img[4] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\6.png";
img[5] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\7.png";
img[6] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\9.png";
img[7] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\10.png";
img[8] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\11.png";
img[9] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\13.png";
img[10] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\14.png";
img[11] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\15.png";
img[12] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\17.png";
img[13] = @"C:\Users\Student\Documents\APPD\Asgmt\Asgmt\Assignment\Assignment\handcards\18.png";
//so on and so forth
return
img;
}
public void Form2_Load(object sender, EventArgs e)
{
//the code I'm trying now:
string[] Player1Array = GetImages(40/2);