473,404 Members | 2,213 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,404 software developers and data experts.

I Need Help! BINGO Java program Project

5
Hey, I have a project due around February 28. I have to create a program that asks the user for the number of players that want to play bingo. Then it creates that many bingo cards. Then it calls out BINGO numbers, but it can't make a repeat call out. Also, when something is called out, I have to somehow mark on the card that it has been called out. When the person gets 5 horizontally or vertically (not diagonally) then the programs says that player wins.

This is my first/probably only programming class so I'm a little confused. I'm thinking a 2D array for the entire possible list with 15 rows and 5 columns... not sure how to create 2D arrays for the cards from that array without having repeats. Any tips or hints or a little help to stop repeats within each card and within the call outs?
Feb 20 '08 #1
9 4998
BigDaddyLH
1,216 Expert 1GB
One way to get random selection without repetition is to take a list and instead of repeatedly randomly selecting from the list (which might incur repetition), shuffle the list. Then simply iterate through the shuffled list -- think of shuffling a deck of playing card and going through the deck after that -- you won't see the same card twice!

Alternately, let repetitions occur but notice this and repeat the random selection until what you choose is not a repetition.
Feb 20 '08 #2
Fsunka
5
One way to get random selection without repetition is to take a list and instead of repeatedly randomly selecting from the list (which might incur repetition), shuffle the list. Then simply iterate through the shuffled list -- think of shuffling a deck of playing card and going through the deck after that -- you won't see the same card twice!

Alternately, let repetitions occur but notice this and repeat the random selection until what you choose is not a repetition.
How would I shuffle the list? Is there some code or something? I heard one of my classmates talking about putting the randomly selected call outs in a new array and somehow using that array to prevent repetitions, but I only know the logic of java rather than codes, hopefully my teacher will help tomorrow or someone here can tell me how to shuffle the list (completely so that it would call out for example: B12, N38, B7, etc. like a real bingo game) or how to put the random callouts in a new array and how that would prevent repetitions. Thanks for your help so far and luckily I have a while to work it out since we're still in the planning stages.
Feb 21 '08 #3
BigDaddyLH
1,216 Expert 1GB
Here is how I would random shuffle a pack of cards in a way that could translate to code. (Call the positions in the deck 0 to 51.)

* Randomly choose a card in the range 0 <= c <= 51; swap that card with the one at position 51 (bottom of the deck).
* Randomly choose a card in the range 0 <= c <= 50; swap that card with the one at position 50.
* Randomly choose a card in the range 0 <= c <= 49; swap that card with the one at position 49
...
* Randomly choose a card in the range 0 <= c <= 2; swap that card with the one at position 2
* Randomly choose a card in the range 0 <= c <= 1; swap that card with the one at position 1
Done!

You've essentially drawn all the cards out of the deck in a random order, but without having to create a second data structure.
Feb 21 '08 #4
Fsunka
5
I see how that would work for the callouts but could I use that for creating the cards? Is there a way to reset the array so it can do it for every card?
Feb 21 '08 #5
Fsunka
5
nvm i think ill use if statements for the cards since she let us know that we can set the maximum number of players/cards to 4 so we can have definite variables.
Feb 21 '08 #6
BigDaddyLH
1,216 Expert 1GB
I see how that would work for the callouts but could I use that for creating the cards? Is there a way to reset the array so it can do it for every card?
Could you define the following:
* What is a "callout"?
* What do you mean by "creating the cards"?
* What do you mean by "reset the array"?
Feb 21 '08 #7
BigDaddyLH
1,216 Expert 1GB
nvm i think ill use if statements for the cards since she let us know that we can set the maximum number of players/cards to 4 so we can have definite variables.
* What do you mean by "if statements for the cards"? How can a card be an if statement?
* What is a "definite variable"?
Feb 21 '08 #8
Fsunka
5
My teacher saw this (she only read the title) and assumed our group was cheating. She accused us of getting methods/codes written by the people here, and I told her to just look at the posts and that I was just asking for hints/ideas, but she wouldn't listen.
I didn't think it was wrong or else I would've closed the window, but what she thinks is what counts. I guess we should've asked for her help instead, but I didn't think she would help on this project (I was wrong as I found at later when she was eager to help). Bad mistake so now we have to do a battleship project but we will NOT ask for any outside help on this new project, although thank you for your effort.
Feb 25 '08 #9
BigDaddyLH
1,216 Expert 1GB
My teacher saw this (she only read the title) and assumed our group was cheating. She accused us of getting methods/codes written by the people here, and I told her to just look at the posts and that I was just asking for hints/ideas, but she wouldn't listen.
I didn't think it was wrong or else I would've closed the window, but what she thinks is what counts. I guess we should've asked for her help instead, but I didn't think she would help on this project (I was wrong as I found at later when she was eager to help). Bad mistake so now we have to do a battleship project but we will NOT ask for any outside help on this new project, although thank you for your effort.
Oh well. She should have layed out the ground rules more clearly at the beginning of the project. Good luck!
Feb 25 '08 #10

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

Similar topics

6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
0
by: xunling | last post by:
i have a question about answering ..... this topic is "need help" what do i have to write at te topic line, !after i have klicked the "answer message" button ive tried many possibilities,...
1
by: MSDN Account | last post by:
We have web site that used the IIS ResKit tool MSWC.PermissionChecker to check file permissions. The web site has been upgraded and that upgrade included changing the default server side language...
2
by: bryan | last post by:
I have a situation that's pretty delicate that I need some help on. I've been stumped for awhile I just need some advice on the best possible solution. The problem: I have a site I'm making...
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
23
by: vinod.bhavnani | last post by:
Hello all, I need desperate help Here is the problem: My problem today is with multidimensional arrays. Lets say i have an array A this is a 4 dimensional static array.
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
2
by: XML Beginner | last post by:
I have an XML file that contains values that my application needs, so it knows which database to connect to. It also contains a configuration option so that I can specify which node to return...
7
by: themastertaylor | last post by:
Hi, I work for a construction company and part of my job is sourcing materials. currently we have a spreadsheet based system whereby each site has a worksheet in the workbook with the standard...
1
by: jhaydon | last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.