This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// генератор случайных чисел в заданном диапазоне | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min)) + min; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// переменные для исходного сообщения, зашифрованного и ключа шифрования | |
var input, output,key; | |
// служебные переменные для шифра | |
var inp, k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# подключаем модуль случайных чисел | |
import random | |
# подключаем модуль для графиков | |
import plotly | |
import plotly.graph_objs as go | |
# сколько денег будет на старте для каждой стратегии | |
startmoney = 1000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# строим графики | |
fig = go.Figure() | |
# для первой стратегии | |
fig.add_trace(go.Scatter(x=games1, y=balance1, name = "Отрицательное матожидание")) | |
# для второй | |
fig.add_trace(go.Scatter(x=games2, y=balance2, name = "Нулевое матожидание")) | |
# и для третьей | |
fig.add_trace(go.Scatter(x=games3, y=balance3, name = "Положительное матожидание")) | |
# выводим графики в браузер | |
fig.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# начинаем играть с полной суммой | |
# первая стратегия — отрицательное матожидание, как в казино | |
money = startmoney | |
# пока у нас ещё есть деньги | |
while money > 0: | |
# ставка — постоянная часть от первоначальной суммы | |
bet = startmoney * c1 | |
# если ставка получилась больше, чем у нас осталось денег — ставим всё, что осталось, чтобы не уйти в минус | |
if bet > money: | |
bet = money |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# подключаем модуль случайных чисел | |
import random | |
# подключаем модуль для графиков | |
import plotly | |
import plotly.graph_objs as go | |
# сколько денег будет на старте для каждой стратегии | |
startmoney = 1000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// «Липкий» код | |
$(function(){ | |
$.fn.followTo = function (pos) { | |
var $this = this, | |
$window = $(window); | |
$window.scroll(function (e) { | |
if ($window.scrollTop() > pos) { | |
$this.css({ | |
position: 'fixed', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* отвечает за оба блока в целом */ | |
section{ | |
max-width: 600px; | |
margin:0 auto; | |
} | |
/* настройки основного блока */ | |
.col-md-10{ | |
min-height: 900px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section> | |
<div class="row"> | |
<!-- основной блок шириной 10 колонок --> | |
<div class="col-md-10"> | |
<!-- сюда кладём то, что будет вести себя как обычная страница --> | |
<div class="content-block"> | |
<h3>Заголовок</h3> | |
<p>Тут — любой текст, картинки или что-то ещё. Это же бутстрап, здесь можно всё.</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// переменные для булочек и для количества детей | |
var a,b,c; | |
var i; | |
// ограничиваем цикл максимальным количеством возможных булочек — 21 | |
for (i = 1; i <= 21; i++){ | |
// если число детей чётное, то продолжаем | |
if (i % 2 == 0){ | |
// на 70 рублей можно максимум купить по 7 наборов булочек каждого сорта |