CoinFlip Challenge solution sometimes guesses wrong

I am working on a coinflip challenge,To automate the solution, I am using Foundry.But sometimes my solution guesses the wrong and, due to that, consecutive wins are set to 0.
Here is my foundry solution. I am not able to find out what I am doing wrong.

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "forge-std/Test.sol";
import "../src/level3.sol";
import "../lib/SafeMath.sol";

contract Attack is Script {
    using SafeMath for uint256;

    CoinFlip level3 = CoinFlip(0x6565F3e9AAfa1ea1cba24b9D1c131EC61a158608);
    uint256 FACTOR = 57896044618658097711785492504343953926634992332820282019728792003956564819968;

    function run() external
            uint256 blockValue = uint256(blockhash(block.number.sub(1))>
            uint256 coinFlip = blockValue.div(FACTOR);
            bool side = coinFlip == 1 ? true : false;
            if (side)
            console.log("Consecutive Wins: ", level3.consecutiveWins());

Here is my command output.

I will throw out some ideas.

Maybe try getting rid of the Factor and instead of blockValue.div(factor) do blockvalue % 2

I am kind of guessing, based on what I think your code does.

Sometimes Else does not do what I wish it did. I usually just use a second if statement.