Non-Linear programming :)

Hi everyone

So I am currently working on a non-linear model for my third year stats course & I need some help.

I want to create a linking constraint for 2 decision variable, Pi and Xi.
Pi = percentage of votes for state "i"
Xi = binary variable X={0,1)
if X=1 --> this is a "win"
if X=0 --> this is a "loss"

How can I create a linking constraint so that if Pi>=51, then X=1 (a win) and if Pi<51 then X=0 (a loss) ?

Any advice would be appreciated.