mardi 17 janvier 2017

Visual Basic (Vb.Net) Shuffling/Randomizing

I am currently working on a 15-shuffle game in visual basic. This is supposed to be a final game for my computer science 1 course. I am supposed to make a game with only the knowledge acquired in class but also am supposed to introduce one new concept.

I got the 16 buttons to move around and work, the main problem that I am facing right now is that I don't know how to shuffle the buttons. I want the buttons to shuffle once I click a button on the form. I am thinking of using Fisher-Yates scrambling method to shuffle the 16 buttons randomly, but don't really know how to write it, If anyone could help I would really appreciate it. The scrambling mechanism I am currently using does not fully work because if two buttons generate the same random number, they land on the same spot. I will attach a hastebin link with the current code I have. Please help me come up with a better way to shuffle the buttons.

http://ift.tt/2iG9xd4




Aucun commentaire:

Enregistrer un commentaire