Загрузка...

ИГРОВАЯ СЛОТ МАШИНА ЗА ПАРУ МИНУТ?

Тема в разделе C# создана пользователем WHUSEIN 31 авг 2020. 618 просмотров

  1. WHUSEIN
    WHUSEIN Автор темы 31 авг 2020 Заблокирован(а) 1016 2 окт 2019
    [IMG]

    Над оформлением не работал при желание можно привести к более привлекательному виду, перейдем к самому коду.

    Код
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace slot
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }


    // Начальные значения
    public static long credits = 50;
    public static long total = 0;
    public static int bet = 5;


    public static int p1;
    public static int p2;
    public static int p3;


    private void Form1_Load(object sender, EventArgs e)

    {

    pictureBox1.Image = Image.FromFile("2.png");
    pictureBox2.Image = Image.FromFile("3.png");
    pictureBox3.Image = Image.FromFile("1.png");


    }


    // Генерация рандомных чисел
    public static class IntUtil
    {
    private static Random random;

    private static void Init()
    {
    if (random == null) random = new Random();
    }
    public static int Random(int min, int max)
    {
    Init();
    return random.Next(min, max);
    }
    }



    private void button1_Click_1(object sender, EventArgs e)
    {
    if (credits >= bet)
    {
    credits = credits - bet;
    label1.Text = "Credits: " + credits.ToString();

    for (var i = 0; i < 10; i++)
    {
    p1 = IntUtil.Random(1, 4);
    p2 = IntUtil.Random(1, 4);
    p3 = IntUtil.Random(1, 4);

    }

    if (pictureBox1.Image != null) pictureBox1.Image.Dispose();
    pictureBox1.Image = Image.FromFile(p1.ToString() + ".png");

    if (pictureBox2.Image != null) pictureBox2.Image.Dispose();
    pictureBox2.Image = Image.FromFile(p2.ToString() + ".png");

    if (pictureBox3.Image != null) pictureBox3.Image.Dispose();
    pictureBox3.Image = Image.FromFile(p3.ToString() + ".png");



    total = 0;

    // Выводы результатов

    if (p1 == 3) total = total + 0;

    if (p1 == 2 & p2 == 2) total = total + 10;
    if (p1 == 3 & p2 == 3) total = total + 0;

    if (p1 == 1 & p2 == 1 & p3 == 1) total = total + 500;
    if (p1 == 2 & p2 == 2 & p3 == 2) total = total + 200;
    if (p1 == 3 & p2 == 3 & p3 == 3) total = total + 0;



    credits = credits + total;
    label3.Text = "Win: " + total.ToString();
    label1.Text = "Credits: " + credits.ToString();

    total = 0;
    }
    }


    private void button4_Click(object sender, EventArgs e)
    {
    MessageBox.Show("50 Credits = 50р");
    }

    }
    }
     
  2. PCDcode
    PCDcode 31 авг 2020 Заблокирован(а) 1518 22 июл 2019
    Лучше бы на пайтоне телеграм бота по слотам сделал бы и продавал :2011_like:
     
    1. WHUSEIN Автор темы
      PCDcode, знал бы я пайтон)
    2. PCDcode
      WHUSEIN, php вроде тоже можно)
  3. DLCISHIK228
    DLCISHIK228 31 авг 2020 122 9 дек 2018
    Пойду создам скам казино, и буду рубить шекели.
     
  4. tentrun
    tentrun 1 сен 2020 3 30 авг 2017
    Я чото выпал с проверки
    Почитай про case и циклы
     
Top
Загрузка...