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