# Coin Flip

Coin Flip uses the boolean

`isHeads`

to decide the outcome of a coin flip with `true`

or `false`

.if (coinFlip[i] == 1 && game.isHeads == true) {

if (coinFlip[i] == 0 && game.isHeads == false) {

Player outcome | Probability |
---|---|

Heads | 50% |

Tails | 50% |

A 2% fee is taken off the payout by multiplying with 1.98 when a player wins. No fee is taken on a loss. The 2% fee can be found in the Coin Flip contract:

payout += (game.wager * 19800) / 10000;

payouts[i] = (game.wager * 19800) / 10000;

This gives the following multiplier:

Player outcome | Fee | Multiplier |
---|---|---|

Win | 2% | 1.98x |

Loss | 0% | 0x |

With this information, the house edge for Coin Flip can be calculated at 1% (

`(2+0)/2`

).With the above in mind the odds and house edge for Coin Flip are:

Odds | Outcome |
---|---|

Decimal odds | 0.99 |

Return to Player | 99% |

Probability odds | 49.5% |

Last modified 4mo ago