-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
54 lines (53 loc) · 1.93 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const config = {
probabilityOfDonorToBeAutistic: 0.05,
probabilityOfRecipientToBeAutistic: 0.05,
chanceOfDonationToCauseAutisticChild: {
ifBothPartnersAreAutistic: 1,
ifOnePartnerIsAutistic: 0.5,
ifNoneAreAutistic: 0
},
chanceThatRecipientWillSkipChoosingDonor: {
ifRecipientIsNeurotypical: 0.2,
ifRecipientIsAutistic: 0.2,
},
chanceThatInvolvedRecipientWillChooseAutisticDonor: {
ifRecipientIsNeurotypical: 0.125,
ifRecipientIsAutistic: 0.6,
}
} as const;
const asd = [
{
getCoefficient: () => config.probabilityOfRecipientToBeAutistic,
option: 'autistic recipient',
reverseOption: 'neurotypical recipient'
},
{
getCoefficient: (ctx: Set<string>) =>
ctx.has('autistic recipient')
? config.chanceThatRecipientWillSkipChoosingDonor.ifRecipientIsAutistic
: config.chanceThatRecipientWillSkipChoosingDonor.ifRecipientIsNeurotypical,
option: 'decided to skip',
reverseOption: 'decided not to skip'
},
{
getCoefficient: (ctx: Set<string>) =>
ctx.has('decided not to skip')
? (ctx.has('autistic recipient')
? config.chanceThatInvolvedRecipientWillChooseAutisticDonor.ifRecipientIsAutistic
: config.chanceThatInvolvedRecipientWillChooseAutisticDonor.ifRecipientIsNeurotypical)
: config.probabilityOfDonorToBeAutistic,
option: 'autistic donor',
reverseOption: 'neurotypical donor'
},
{
getCoefficient: (ctx: Set<string>) =>
ctx.has('autistic recipient') && ctx.has('autistic donor')
? config.chanceOfDonationToCauseAutisticChild.ifBothPartnersAreAutistic
: ctx.has('neurotypical recipient') && ctx.has('neurotypical donor')
? config.chanceOfDonationToCauseAutisticChild.ifNoneAreAutistic
: config.chanceOfDonationToCauseAutisticChild.ifOnePartnerIsAutistic,
option: 'will cause autistic child',
reverseOption: 'will cause neurotypical child'
},
];
// type Iterate =