C
C#14mo ago
pat

❔ ✅ 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
Pobiega
Pobiega14mo ago
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?
pat
patOP14mo ago
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.
Pobiega
Pobiega14mo ago
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
MODiX
MODiX14mo ago
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!
pat
patOP14mo ago
All 400 lines?
Pobiega
Pobiega14mo ago
well, yes can't help without knowing what you have
pat
patOP14mo ago
BlazeBin - qyfncdmxrzc
A tool for sharing your source code with the world!
Pobiega
Pobiega14mo ago
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 arrays
pat
patOP14mo ago
There'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
Pobiega
Pobiega14mo ago
ah, i see. so tahts the source of truth (why is it a 2d array thou? thats just wack) whatever
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
what is vsiNbBoulesRetirées btw? curious topic. they are pretty much never used in real life
pat
patOP14mo ago
It's the number over the button "Retirer". This goes up by one every time you click it and an index gets disabled in viaBoulier
Pobiega
Pobiega14mo ago
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?
pat
patOP14mo ago
Yeah he made it all
Pobiega
Pobiega14mo ago
okay, can you paste that class as well?
pat
patOP14mo ago
How do I do that?
Pobiega
Pobiega14mo ago
well I assume you have the source? so just copy and paste it at the same place as you did the last one
pat
patOP14mo ago
I'm not sure what that referes to. I'm very new and just fill in the blanks he leaves us lol.
Pobiega
Pobiega14mo ago
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"
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
well that makes sense
pat
patOP14mo ago
How tho?
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
Fair, yeah, that's exactly what I'm trying to do. For some reason I was thinking the grid should be the index
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
Yeah, I was just confused I know I have to use DisableCell
Pobiega
Pobiega14mo ago
>_>
Pobiega
Pobiega14mo ago
No description
Pobiega
Pobiega14mo ago
I stumbled upon this on some google docs thing that linked to a removed website okay, what arguments does DisableCell take?
pat
patOP14mo ago
This looks sort of similar to a project we've already done lmao
pat
patOP14mo ago
No description
Pobiega
Pobiega14mo ago
is your teacher "Stephane Demeutes"? 😄
pat
patOP14mo ago
Nope
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
No description
Pobiega
Pobiega14mo ago
okay, so you can access it either with 1d or 2d index this is great news for us because guess what vsiNbBoulesRetirees is?
pat
patOP14mo ago
VisualInt? Idk 😓
Pobiega
Pobiega14mo ago
... no its the 1d index of the "next ball"
pat
patOP14mo ago
OH lmfao right yes sorry I didn't get what you meant
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
For this part, I'm pretty sure it's all 1d The other card is 2D
Pobiega
Pobiega14mo ago
.. 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 now
pat
patOP14mo ago
All I meant was this one I go through sequentially. The other one is where I bring in rowcount, columncount etc
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
What is an event handler
Pobiega
Pobiega14mo ago
public void btnRetirerUneBouleDuBoulier_Click(object sender, EventArgs e)
pat
patOP14mo ago
What do I do with that?
Pobiega
Pobiega14mo ago
mark the current number as disabled, then increment the counter
pat
patOP14mo ago
I mean, where do I do that?
pat
patOP14mo ago
No description
Pobiega
Pobiega14mo ago
? I.. legit don't understand the question. You are showing me the answer to your own question, IN your question.
pat
patOP14mo ago
What values can I change??
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
but why do you need to go through the grid here?
pat
patOP14mo ago
Because when I start my bingo game the grid is set
Pobiega
Pobiega14mo ago
and what is "go through my index"?
pat
patOP14mo ago
It goes through each one, disables it, then ups the ball count by one One secon
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
It goes to the next cell though
Pobiega
Pobiega14mo ago
... yes, which is sequential its literally "the next cell"
pat
patOP14mo ago
Doesn't it need a for still? to go through the grid
Pobiega
Pobiega14mo ago
you do not need a loop because you do not need to go through the grid
pat
patOP14mo ago
How do I sequentially disable the cells then? I thought it went through a loop and disabled them as it went
Pobiega
Pobiega14mo ago
it disables ONE cell not many
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
you understand that this method is called once per click on the button, yes?
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
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
pat
patOP14mo ago
I'm sorry, I'm not having fun either lmao
Pobiega
Pobiega14mo ago
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?
pat
patOP14mo ago
Bro I am so dumb Pretty much have it I just have to get it to start on 0 Jesus
Pobiega
Pobiega14mo ago
hint: check what order you do things you increment before disabling
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
yw you're far from done, btw 😛
pat
patOP14mo ago
Yeah, I know 😓
Pobiega
Pobiega14mo ago
you still need to make it "disable" the value on the other views too
pat
patOP14mo ago
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
Pobiega
Pobiega14mo ago
yw 🙂
Accord
Accord13mo ago
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.
Want results from more Discord servers?
Add your server