g | x | w | all
Bytes Lang Time Link
220Python 2180803T125029ZTFeld
192JavaScript Node.js180804T010530ZNeil

Python 2, 230 225 221 220 bytes

I've posted this answer, as I found out the rules while creating this answer to the other question.

def f(D,V):v,s=D[:2];d=D.count('X');m=int(D.split()[1]);v=int(v);C=3-(s<'E');P=(v*C+(s=='N'))*2**d;W=-~V;return[-~W*25*max(0,v-5)+P+m*[C,10*W,20*W][d]+5*d+[5,30+20*V][P>9],((m-W)*3+7+~-V*max(0,m+3))*d*10or+W*m*5][m<0]*10

Try it online!


Saved:

JavaScript (Node.js), 211 204 195 192 bytes

(r,v,[,c,s,d,t]=r.match(/(.)(.T?)(X*)(.*)/),l=d.length,m=s>'D',g=(c*(m+=2)+!!s[1])<<l)=>10*(t<0?10*(l*(v?3*t+1:-"13"[~t]||3*t+4)||t):g+(10*l*-~v||m)*t+5*l+25*(c>5&&(5-c)*~-~v)+5*(g>9?4*v+6:1))

Try it online! Link includes test cases. Edit: Saved 6 bytes by multiplying by 10 at the end. Saved 9 bytes thanks to @Arnauld. Explanation:

(r,v

Input the result as a string and the vulnerability as a boolean (or 1/0).

,[,c,s,d,t]=r.match(/(.)(.T?)(X*)(.*)/)

Split the string up into contract, suit, doubles and (over/under)tricks.

,l=d.length

Count the number of doubles.

,m=s>'D'

Track whether this is a major or minor suit.

g=(c*(m+=2)+!!s[1])<<l

Calculate the contract score. This is 3 per major suit or 2 per minor suit trick, plus 1 extra for no trump, and then doubled or redoubled as appropriate.

)=>10*

The score is always a multiple of 10. Subsequent comments take this multiplication into account.

(t<0

Do we have undertricks?

?10*

Undertricks are multiples of 100.

(l*(v?3*t+1:-"13"[~t]||3*t+4)

If they're doubled, then the potentially redoubled score depending on the vulnerability or number of undertricks.

||t)

But if they're not doubled, then just the number of undertricks.

:g

If the contract is made, then we start with the contract score.

+(10*l*-~v||m)*t

Add on overtricks; per trick, if doubled then 100 potentially redoubled and doubled again if vulnerable, otherwise 30 for major or 20 for minor suits.

+5*l

Add on the potentially redoubled doubled game bonus.

+25*(c>5&&(5-c)*~-~v)

Add on the slam bonus if applicable.

+5*(g>9?4*v+6:1))

Add on the game bonus.