C
C#ā€¢14mo ago
nawt in use ;(

ā” Implement local players using a single button in Windows Forms bowling game

Csharp!!!
36 Replies
Pobiega
Pobiegaā€¢14mo ago
okay, so, how do you currently track the players score/stats/whatever?
nawt in use ;(
nawt in use ;(ā€¢14mo ago
I havent created the most sophistiaced way to do that, i just write it in and dont mess with it
Pobiega
Pobiegaā€¢14mo ago
$code
MODiX
MODiXā€¢14mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
nawt in use ;(
nawt in use ;(ā€¢14mo ago
should i post my whole thing?
Pobiega
Pobiegaā€¢14mo ago
sure
nawt in use ;(
nawt in use ;(ā€¢14mo ago
BlazeBin - tmnoirhpfumg
A tool for sharing your source code with the world!
nawt in use ;(
nawt in use ;(ā€¢14mo ago
How the UI looks like currently
Pobiega
Pobiegaā€¢14mo ago
Ah okay, so its a bowling score calculation app more or less
nawt in use ;(
nawt in use ;(ā€¢14mo ago
Basically
Pobiega
Pobiegaā€¢14mo ago
so, currently your entire program runs its logic when you press that button "Calculate Score" it seems I imagine it would be more useful as a score calc app if you would take turns, like you do in bowling so I would enter my frame one score, then you enter yours, I enter frame two, etc
nawt in use ;(
nawt in use ;(ā€¢14mo ago
ya exactly thats what i thought would be best
Pobiega
Pobiegaā€¢14mo ago
okay, so we need to track a few more things and introduce some new variables First, we should make a class that represents a single player and their entries we can then store an array or a list of these in our program to make it easy to have multiple players we also need to track what frame we are on and some way of keeping track what players turn it is
nawt in use ;(
nawt in use ;(ā€¢14mo ago
Ive created a class, not sure how to do the rest.
Pobiega
Pobiegaā€¢14mo ago
what does your class look like?
nawt in use ;(
nawt in use ;(ā€¢14mo ago
namespace BowlingProgram { class Player { } }
Pobiega
Pobiegaā€¢14mo ago
$codegif
Pobiega
Pobiegaā€¢14mo ago
and leave the namespace out :p you'll need to add some data to that class a name or number to identify the player and their frame values, for example
nawt in use ;(
nawt in use ;(ā€¢14mo ago
line an int? or string or whatever
Pobiega
Pobiegaā€¢14mo ago
yeah, a property
nawt in use ;(
nawt in use ;(ā€¢14mo ago
public string Name { get { return _name; } } looks good?
Pobiega
Pobiegaā€¢14mo ago
public string Name { get; }
public string Name { get; }
is all you need also, please use the backticks when pasting code in discord 3 backticks followed by the word "cs", like in the gif above ```cs like that
nawt in use ;(
nawt in use ;(ā€¢14mo ago
public string Name { get; }
public string Name { get; }
there!
Pobiega
Pobiegaā€¢14mo ago
almost but not quite
nawt in use ;(
nawt in use ;(ā€¢14mo ago
okay, should i create one for a number as well or is that enough? oh yeah yours has colours ill watch the gif in the mean time
Pobiega
Pobiegaā€¢14mo ago
well if we have the name we dont need a number, since they can be "{name}" instead of "player {number}"
nawt in use ;(
nawt in use ;(ā€¢14mo ago
public string Name { get; }
public string Name { get; }
Okay, so what should the next step be a list?
Pobiega
Pobiegaā€¢14mo ago
well you used a 2d array in your current code I'm not personally a big fan of that, but it works
nawt in use ;(
nawt in use ;(ā€¢14mo ago
Can't do much else lol
Pobiega
Pobiegaā€¢14mo ago
this is kinda how I imagine it playing btw
Now playing frame number 1
Pobiega's turn.
First shot: 10
Strike!
Nyaa's turn.
First shot: 7
Second shot: 3
Spare!
Now playing frame number 2
Pobiega's turn.
First shot:
Now playing frame number 1
Pobiega's turn.
First shot: 10
Strike!
Nyaa's turn.
First shot: 7
Second shot: 3
Spare!
Now playing frame number 2
Pobiega's turn.
First shot:
this is the output from my console version of this app btw šŸ™‚ sure you can. You could for example create a struct that was two ints, and store an array of that. its a bit more complicated thou, so we can keep using a 2d array its not a problem
nawt in use ;(
nawt in use ;(ā€¢14mo ago
youve made a console bowling?
Pobiega
Pobiegaā€¢14mo ago
well, its just a score keeper just like yours but yes I made it now, while talking to you
nawt in use ;(
nawt in use ;(ā€¢14mo ago
that was also my vision without the label saying whos turn it is lol in the 10 minutes it took me to create a string lol
Pobiega
Pobiegaā€¢14mo ago
Don't compare yourself to others, especially not ones with 20+ years of experience šŸ™‚ So, did you create a score array for the player? ĀÆ\_(惄)_/ĀÆ Gonna go sleep. Good luck!
Accord
Accordā€¢14mo 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
More Posts
ā” WPF - Use command of viewmodel instead of item on clickHi, I have a list of strings and display them as buttons. The list is held by a viewmodel and the vā” Error when deploy a webserviceHello everyone. I'm trying to fix this error when I deploy my app: The configured user limit (128) āœ… Recursive type definitionThis is valid (basically CRTP): ```csharp class Base<T> { } class Derived<T> : Base<Derived<T>> { } ā” Covariant Interface ReturnIs there some reason why this doesn't work? I understand we can get this behavior with virtual methoā” WPF Excel Help -I've made an entire post about the problem on C# subreddit. Here's the link to it : https://www.reddHow to do a 3 way merge on a file that has been moved after folder structure and refactoring change?The repo I am working in has been radically refactored. The folder structure has changed and a long ā” I have a project that I need to submit in 6 hours, but I'm stuck at one point.Project: The project aims to develop a web interface where a minimum of 3 and a maximum of 5 people'ā” System.MissingMethodException: Entry point not found in assemblyHi i try to run an example program build inside my library. When i run the debuger (Visual Studio Cāœ… run async funtion from constructorwe can't use await keyword in the constructor because we can't add `async` keyword to it. How to runā” tls 1.2 serverI'm the server and for some weird reason other than the server certificate I also have to send right