C
C#2y ago
Oli

❔ Need some help with logic

im trying to make a the total defence and attack statistics equal to 35 (they are randomised for 6 players) heres the code: https://paste.mod.gg/ hope i explained it well enough
BlazeBin
A tool for sharing your source code with the world!
37 Replies
Oli
OliOP2y ago
from line 49 to 80
Angius
Angius2y ago
$js
Angius
Angius2y ago
This is a C# server, you're more likely to get TS help in a JS-oriented one $ts
Angius
Angius2y ago
Oh, there's even a TS server
Oli
OliOP2y ago
yeah im doing c#
Angius
Angius2y ago
That code looks an awful lot like Typescript, though
Oli
OliOP2y ago
why do people keep saying that it looks like java am i just that shit
Angius
Angius2y ago
? The code you sent is Typescript Not C#
Oli
OliOP2y ago
is it
Angius
Angius2y ago
Two different languages You're asking for help with your French homework in a server for learning Japanese
Oli
OliOP2y ago
yeah i get what your saying but im fairly sure that isnt typescript
Noah
Noah2y ago
@haakonseni don't see any code when i open the link
Angius
Angius2y ago
It most definitely is Even the file extensions are .ts
import { ensureDir } from 'https://deno.land/[email protected]/fs/mod.ts';
import { ensureDir } from 'https://deno.land/[email protected]/fs/mod.ts';
Oli
OliOP2y ago
Oli
OliOP2y ago
ive never written that
Angius
Angius2y ago
It also loads libraries from deno.land which is a package service for Deno, a Typescript-based runtime
Oli
OliOP2y ago
i think i just sent a wrong link
Angius
Angius2y ago
Ah
Oli
OliOP2y ago
im not that smart tbh
Angius
Angius2y ago
Yeah, your link seems to lead to paste.mod.gg and it just shows the latest paste lol
Oli
OliOP2y ago
yeah sorry for that
Angius
Angius2y ago
After you paste code there you need to click the save button, then you'll get the actual link
Oli
OliOP2y ago
and thanks for trying to help aswell cheers
Noah
Noah2y ago
Okay what exactly do you want to do
Oli
OliOP2y ago
so i want the total value of attack and defence of every player in the team to equal 35
Angius
Angius2y ago
In other words, generate 6 random numbers that sum up to 35
Oli
OliOP2y ago
12 i didnt think of it like that actually
Noah
Noah2y ago
Here are a few things you could try to make the total attack and defence statistics equal to 35:
1: Instead of generating random attack and defence scores for each player, you could try setting the attack and defence scores manually. For example, you could divide the 35 points evenly among the 6 players, giving each player 5 attack points and 5 defence points. This would ensure that the total attack and defence scores are always equal to 35.

2:
If you want to keep the random element in the game, you could try changing the way you generate the random attack and defence scores. Currently, you are using the "Random" class to generate random numbers between 0 and 10 for attack and between 0 and 7 for defence. You could try adjusting the range of the random numbers to make it more likely that the total attack and defence scores will be equal to 35.

3:
You could also try using a different approach to ensure that the total attack and defence scores are equal to 35. For example, you could generate random attack and defence scores for each player as you are doing currently, but then keep track of the total attack and defence scores. If the total attack and defence scores are not equal to 35, you could adjust the scores for one or more players until the total is equal to 35.
1: Instead of generating random attack and defence scores for each player, you could try setting the attack and defence scores manually. For example, you could divide the 35 points evenly among the 6 players, giving each player 5 attack points and 5 defence points. This would ensure that the total attack and defence scores are always equal to 35.

2:
If you want to keep the random element in the game, you could try changing the way you generate the random attack and defence scores. Currently, you are using the "Random" class to generate random numbers between 0 and 10 for attack and between 0 and 7 for defence. You could try adjusting the range of the random numbers to make it more likely that the total attack and defence scores will be equal to 35.

3:
You could also try using a different approach to ensure that the total attack and defence scores are equal to 35. For example, you could generate random attack and defence scores for each player as you are doing currently, but then keep track of the total attack and defence scores. If the total attack and defence scores are not equal to 35, you could adjust the scores for one or more players until the total is equal to 35.
Oli
OliOP2y ago
cheers
Noah
Noah2y ago
<a:CH_ShiroPat:970610996425142342>
Angius
Angius2y ago
Is that ChatGPT?
Noah
Noah2y ago
No?🤔
Angius
Angius2y ago
People often paste ChatGPT's answers into codeblocks like this
Anu6is
Anu6is2y ago
Not to mention the "here are a few things you could try..." Classic ChatGPT
Accord
Accord2y 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. 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