Untitled

mail@pastecode.io avatar
unknown
matlab
2 years ago
894 B
3
Indexable
Never
pointBalance = 100
balance = 1000

if (balance < pointBalance)
    balance = input('100den küçük bir değer girdiniz:')
end
iterationCount = 0
while true
    firstDice = randi(6)
    secondDice = randi(6)
    
    total = firstDice + secondDice;
    
    if (total == 7 || total == 11)
        fprintf('Kazandın tebrikler\n')
        balance += pointBalance
    elseif (total == 2 || total == 3 || total == 12)
        fprintf('Kaybettin\n')
        balance -= pointBalance
    else (total == 4 || total == 5 || total == 6 || total == 8 ||  total == 9 || total == 10)
        fprintf('Kazandın devam edebilirsin\n')
        balance -= pointBalance
    end
    
    fprintf('Yeni bakiyen\n')
    disp(balance)
    
    iterationCount++
    
    if balance < 1
        fprintf('Oyunu kaybettin\n')
        disp(iterationCount)
        fprintf('kez zar atabildin\n')
        break
    end
end