Untitled

mail@pastecode.io avatar
unknown
matlab
2 years ago
1.1 kB
2
Indexable
Never
$pointBalance = 1000
$value = 0

while true
    $value = 1100

    if ($value <= $pointBalance)
        continue
    end

    break
end

$iterationCount = 0

while true
    $firstDice = randi(6)
    $secondDice = randi(6)

    $total = $firstDice + $secondDice

    if ($iterationCount == 0)
        $point = 0
    end

    if ($total == 7 || $total == 11) 
        if ($iterationCount == 0) 
            fprintf('Kazandın tebrikler\n')
            $pointBalance += $value
        else 
            if ($total == 7) 
                fprintf('Kaybettin')
        
                $pointBalance -= $value
            end
        end
    elseif (($total == 2 || $total == 3 || $total == 12) && $iterationCount == 0)
        fprintf('Kaybettin')

        $pointBalance -= $value

        continue
    else 
        if ($iterationCount == 0)
            $point = $total
        end
    end

    $iterationCount++

    if ($total == $point)
        fprintf('Kazandın')
        $pointBalance += $value
    end

    if ($pointBalance < 1)
        fprintf('bitti')

        break
    end
end