473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Deciding offense and defense in a basketball game

Hello all,

I'm creating a basketball game with two teams of five players. I need to code the program to randomly pick one player from each team to match up. I've set my teams up but I can't figure out how to randomly pick the players. Can someone point me in the right direction? Thanks for your help. Here's my code for the teams:

Expand|Select|Wrap|Line Numbers
  1. Dim homeplayers(4) As String
  2.         homeplayers(0) = "Michelle Johnson"
  3.         homeplayers(1) = "Jennifer Smith"
  4.         homeplayers(2) = "Jessica Doe"
  5.         homeplayers(3) = "Rebecca Clark"
  6.         homeplayers(4) = "Allison James"
  7. Dim awayplayers(4) As String
  8.         awayplayers(0) = "Monica Hargrove"
  9.         awayplayers(1) = "Micah Manning"
  10.         awayplayers(2) = "Amberly Thompson"
  11.         awayplayers(3) = "Linda Reynolds"
  12.         awayplayers(4) = "Brenda Cheatem
Dec 12 '07 #1
1 1801
Killer42
8,435 Expert 8TB
If you look in our "HowTos" section, there are samples that show in VB how to generate a "random" number. Do that, and use the number as the index in your array to choose a name.
Dec 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

138
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the...
8
by: Jimmy Smits | last post by:
Hi I have been playing with some JS that I cut from another page. It is a NCAA tournament bracket. When the user clicks on the submit button it sends the predictions to a db I have created. I got...
3
by: Peter Proost | last post by:
Hi group, I've got this bit of code (see below) which draws a basketball field in a picturebox (width:198, height:368) but now I was wondering what would be the easiest way to check inside the...
1
by: fowle040 | last post by:
I underlined and bold print my files. I need to know how to make this code into a working game. The object of the game is to have two players 1- belle and 2-beast. I want them to lose and gain...
7
by: Gasten | last post by:
Hello. The last weeks I've been coding a roguelike (you know, like nethack) in python using the nCurses library. Some week ago I ran into a problem: When I made the object for messagebar-output, I...
0
by: vaj | last post by:
Desktop Tower defense the most addictive flash game ever http://www.yelp.com/redir?url=http://www.teenwag.com/show/games
2
by: pokemonmaster | last post by:
How do i make a basketball bounce on python using coding........srry im kinda new to this......
2
by: Michelle Monty | last post by:
I'm creating a two-player Tic-Tac-Toe game. I have the game programmed up until the point that someone wins. I'm not sure how to code this. My board is set as an array - board(2,2). My code is...
9
by: Michelle Monty | last post by:
Hello all, I'm trying to get a shot clock to work in my basketball game program. I've read a couple of tutorials but I'm still not getting it. I need it to start at 24 and go down to 0. As it is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.