❔ ✅ Help with bingo game (beginner school project)
I'm very blocked and maybe someone can help me. There's a lot to explain but I'll provide any additional info needed.
I'm making a bingo game. This bingo game has two cards, one removes the numbers sequentially (this card is supposed to be the ball removers card, it's basically a cheat card, the numbers on this card are the numbers that will come out next). The other card is the normal bingo card.
I'm working on the one that removes the numbers sequentially. We've been seeing for loops, but I was told I do this one without a loop and I'm confused as to how. I'm going to add a video on how it SHOULD function. Again, I'm trying to do the part where the numbers remove sequentially and the number of balls removed increses by 1 every time.
These are the exact instructions this step has (translated though);
//TODO Remove a ball from the lottery drum
//Retrieve a ball number from the lottery drum, using vsiNbBoulesRetirées.Value (this is the empty box just above the Retirer button) as an index in viaBoulier (this is the name of the grid that removes numbers sequentially) and increase the number of balls removed.
//Disable the ball removed from the lottery drum"
81 Replies
okay, so when the "round" is started, the ball order is determined
So, where and how are you stuck? Can you show your current code?
It's hard to show because he segmented it all. I'm up to the part where I have to get the balls to remove sequentially and count as a ball removed. The step after that is to remove the ball on the main card (which is not sequential). I've tried many ways to do the loop but it doesn't work. My index either all sets to 75, all erases, only selects the first number, etc. Basically, I'm stuck. I've got everthing done up until this point.
okay, so when the button is clicked, it should take the "next" ball in the "queue" and.. well, do something with it
you're gonna need to show some details, like the types invovled
ideally just $paste the entire code
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
All 400 lines?
well, yes
can't help without knowing what you have
BlazeBin - qyfncdmxrzc
A tool for sharing your source code with the world!
okay, so the list of numbers to take is the 2d array
viaCarteMaîtresse
, correct?
or is it viaBoulier
?
you have two seemingly identical 2d arraysThere's two cards. The one I'm trying to do now is viaBoulier
Yeah
So
viaBoulier shows the numbers that will come in sequential order. It's a "cheat" sheet if you will
ah, i see.
so tahts the source of truth
(why is it a 2d array thou? thats just wack)
whatever
viaCarteMaitresse is non sequential, I have to set this one up after with a nested loops I think
We're learning 2D arrays right now, so that's probably why
what is
vsiNbBoulesRetirées
btw?
curious topic. they are pretty much never used in real lifeIt's the number over the button "Retirer". This goes up by one every time you click it and an index gets disabled in viaBoulier
its just easier to use a jagged array, or a single dimensional one and map coordinates
ah okay
okay, great
viaBoulier
isnt JUST a 2d array thou, is it? since it has a "MixUp" method
it seems to be a wrapper class that your teacher made?
how do we mark a number as used with it?Yeah he made it all
okay, can you paste that class as well?
How do I do that?
well I assume you have the source?
so just copy and paste it at the same place as you did the last one
I'm not sure what that referes to. I'm very new and just fill in the blanks he leaves us lol.
can you screenshot your solution explorer window?
okay, seems thats some library then
"VisualIntArray"
an int array doesnt have a concept of a number being "used"
I'm also confused why it says to use vsiNbBoulesRetirees.Value as index. Again, this is the blank box that counts how many balls have been removed
well that makes sense
How tho?
because you need to know how many balls have been used to know which one is next
0 => the first ball
1 => the second ball
etc
so whenever the button is clicked, you get the next ball then increment
vsiNbBoulesRetirees.Value
Fair, yeah, that's exactly what I'm trying to do. For some reason I was thinking the grid should be the index
the grid is literally just a grid
it has no concept of "next" or "marking a number as used"
its just a coordinate => number storage device, kinda
Yeah, I was just confused
I know I have to use DisableCell
>_>
I stumbled upon this on some google docs thing that linked to a removed website
okay, what arguments does
DisableCell
take?This looks sort of similar to a project we've already done lmao
is your teacher "Stephane Demeutes"?
😄
Nope
alr, thats the guy who wrote that library
back in 2010 😄
it seems to have an overload (+1 surcharge)
can you show me that one?
not sure we need it, this seems straight forward enough
but just want to be sure
okay, so you can access it either with 1d or 2d index
this is great news for us
because guess what
vsiNbBoulesRetirees
is?VisualInt?
Idk 😓
... no its the 1d index of the "next ball"
OH lmfao right yes sorry I didn't get what you meant
are there any other fun methods on that class?
like, getting a value based on a 1d index?
actually, we should test that it works with a 1d index in a 2d array context. it might not
For this part, I'm pretty sure it's all 1d
The other card is 2D
.. no?
they are both 2d cards
viaBoulier[rangee, colonne] = nombresBoulier++;
thats a 2d accessor right there
but lets just see if this thing works as we think right nowAll I meant was this one I go through sequentially. The other one is where I bring in rowcount, columncount etc
in your button click event handler, mark the current number as disabled, then increment the counter
then show me what happens when you click it a few times
What is an event handler
public void btnRetirerUneBouleDuBoulier_Click(object sender, EventArgs e)
What do I do with that?
mark the current number as disabled, then increment the counter
I mean, where do I do that?
?
I.. legit don't understand the question.
You are showing me the answer to your own question, IN your question.
What values can I change??
step 1, remove that for loop
your teacher even told you it shouldnt be there
so remove it, it does nothing for us atm
step 2: call the method you know you must call,
DisableCell
But I do need it? Don't I use that to go through my index....?
Bro I am so lost. I thought I didn't need a loop inside a loop. The kind of loop that goes through both rows and columns.
I thought I still needed a loop to go through my grid
but why do you need to go through the grid here?
Because when I start my bingo game the grid is set
and what is "go through my index"?
It goes through each one, disables it, then ups the ball count by one
One secon
no it doesnt
in the video you sent, the button marks one cell as disabled, then ups the ball count
thats it
and thats what we are trying to do right now
It goes to the next cell though
... yes, which is sequential
its literally "the next cell"
Doesn't it need a for still? to go through the grid
you do not need a loop
because you do not need to go through the grid
How do I sequentially disable the cells then? I thought it went through a loop and disabled them as it went
it disables ONE cell
not many
When my teacher said I didn't need a loop, I thought he meant I didn't need a loop inside of a loop, because we are doing that a lot, I did it to place the bingo numbers
you understand that this method is called once per click on the button, yes?
Ugh I think the wording of it saying to use the index tripped me up and made me think there was a loop on the grid
Okay, can we get back on track and write the literally 2 lines of code needed to progress now?
its getting absurdly late here :p
I'm sorry, I'm not having fun either lmao
okay, so throw out the loop, disable the "current" cell and increment the counter that keeps track of "current" cell
actually, to speed this up, would it be possible for you to screenshare?
Bro I am so dumb
Pretty much have it
I just have to get it to start on 0
Jesus
hint: check what order you do things
you increment before disabling
Omg I got it
Wow
I was making my life so hard for nothing
Jesus
I'm sorry for the time sink but thank you tremendously kind stranger
yw
you're far from done, btw 😛
Yeah, I know 😓
you still need to make it "disable" the value on the other views too
I have to make it disable on the main card, disable on the 4 bingo cards, and check every horizontal, vertical and diagonal for bingos
Still a lot of work but I was so stuck on that one question. Again, I thought it was so much more complicated
I can't ty enough
yw 🙂
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.