1   2   3
Ім'я файлу: Курсова робота_демо.docx
Розширення: docx
Розмір: 73кб.
Дата: 15.11.2022
скачати
Пов'язані файли:
Аналiз табличних даних.doc
Основи побудови систем штучного інтелекту_ Лекція 1.pdf
Реферат_Сидорчук_ДВ-91.doc
Курсовая работа Мандрица В. РП-17(3).docx
Текущий контроль 2.docx
ЛЕКЦІЇ_Конституц_право_зар_країн.doc
Progr-pidgot-alpinis-ukr-yaz.doc
bestreferat-203983.docx

МІНІСТЕРСТВО ОСВІТИ І НАУКИ УКРАЇНИ НТУ «ДНІПРОВСЬКА ПОЛІТЕХНІКА»




КУРСОВА РОБОТА

З дисципліни «Об’єктне орієнтоване програмування» На тему «Створення ігрового додатку»




Виконав студент групи 121-20-8 Ніколенко Нікола Ніколович

Перевірив: доц. Приходченко С.Д.




Дніпро 2020
Індивідуальне завдання: створення додатка «Казино - рулетка» за допомогою мови програмування C# та інтерфейсу Windows Forms.
Ціль: оволодіти основами ООП, розробкою додатків, та основними елементами мови C#.

Хід роботи:
  1. Реалізація реєстрації та авторизації користувача. Збереження персональних даних користувача.




  1. Розробка інтерфейсу гри, інтуїтивно зрозумілого користувачем. Механіка гри відповідає загальновизнаним правилам «Рулетки».


  1. Реалізація алгоритмів гри: випадкове число, поля ставок, загальна сума фішок, «правила гри».





  1. Наведемо код проекту:

    • CasinoCalculator.cs

using System;

using System.Collections.Generic; using System.Linq;

using System.Text;

using System.Threading.Tasks;
namespace CasinoProject

{

class CasinoCalculator : Casino

//класс вычисляет победу игрока

{



спин?

public static int bet { get; set; } = 0; //ставка игрока

public static bool realspin { get; set; } = false; //Реальный ли
public static int spins { get; set; } //количество спинов

//public static int allbets { get; set; } = bet*amountbets; //

вся сумма ставок

public static int CalculateWin()

//метод проверяет победу и возвращает коэффиценты выигрыша

{

int win = 0;
foreach (var selectedNumber in selectedNumbers)

{

if (number == selectedNumber)

//проверка на число

{
win += bet * 37;

}

}


if (red &&

(number == 1 || number == 3 || number == 5

||

//проверка на красное







number

== 7 || number == 9 || number == 12 ||




number

== 14 || number == 16 || number == 18 ||




number

== 19 || number == 21 || number == 23 ||




number

== 25 || number == 27 || number == 30 ||




number

== 32 || number == 34 || number == 36))




{







win +=

bet * 2;




}








if (black && (number == 2 || number == 4 || number == 6

|| //проверка на черное

number == 8 || number == 10 || number == 11 || number == 13 || number == 15 || number == 17 || number == 20 || number == 22 || number == 24 || number == 26 || number == 28 || number == 29 || number == 30 || number == 33 || number == 35))

{

win += bet * 2;

}
if (dozen1 && number < 13)

//проверка на дюжину

win += bet * 3;

if (dozen2 && (number > 12 && number < 25)) win += bet * 3;

if (dozen3 && (number > 24)) win += bet * 3;
if (pair && number % 2 == 0)

//проверка на четность

{

win += bet * 2;

}
if (impair && number % 2 != 0)

//проверка на не четность

{

win += bet * 2;

}
return win;

}

}

}

    • Casino.cs

using System;

using System.Collections.Generic; using System.Linq;

using System.Text;

using System.Threading.Tasks;
namespace CasinoProject

{

public class Casino

{

public static int amountbets { get; set; } = 0;

//количество сделанных ставок

public static int chips { get; set; }

//общее количество фишек игрока

public static bool buttonenabled = true;

public static List selectedNumbers = new List();

//список всех выбранных чисел

public static int number { get; private set; } = 0;

//правильный номер выбранный машиной

public static bool pair { get; set; } = false;

//ставка на четность

public static bool impair { get; set; } = false;

//ставка на нечетность

public static bool red { get; set; } = false;

//ставка на красный

public static bool black { get; set; } = false;

//ставка на черный

public static bool dozen1 { get; set; } = false;

//ставка на дюжину1

public static bool dozen2 { get; set; } = false;

//ставка на дюжину2

public static bool dozen3 { get; set; } = false;

//ставка на дюжину3

public static string login { get; set;} //логин public static string password { get; set;}

//пароль

//public static string firstchips { get; set;} //первоначальное

количество фишек

//public static string firstspins { get; set;} //первоначальное количество спинов

public static int SetRandNumber() //метод выбирает рандомно правильный номер

{

Random rnd = new Random(); number = rnd.Next(0, 37); return number;
}
}

}


    • Forn1.Designer.cs

namespace CasinoProject
{
partial class Form1

{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;


///
/// Clean up any resources being used.
///

///
name="disposing">true if managed resources should be disposed; otherwise, false.

protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}


#region Windows Form Designer generated code


///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button38 = new System.Windows.Forms.Button(); this.button37 = new System.Windows.Forms.Button(); this.button36 = new System.Windows.Forms.Button();

this.button35 = new System.Windows.Forms.Button(); this.button34 = new System.Windows.Forms.Button(); this.button33 = new System.Windows.Forms.Button(); this.button32 = new System.Windows.Forms.Button(); this.button31 = new System.Windows.Forms.Button(); this.button30 = new System.Windows.Forms.Button(); this.button29 = new System.Windows.Forms.Button(); this.button28 = new System.Windows.Forms.Button(); this.button27 = new System.Windows.Forms.Button(); this.button26 = new System.Windows.Forms.Button(); this.button25 = new System.Windows.Forms.Button(); this.button24 = new System.Windows.Forms.Button(); this.button23 = new System.Windows.Forms.Button(); this.button22 = new System.Windows.Forms.Button(); this.button21 = new System.Windows.Forms.Button(); this.button20 = new System.Windows.Forms.Button(); this.button19 = new System.Windows.Forms.Button(); this.button18 = new System.Windows.Forms.Button(); this.button17 = new System.Windows.Forms.Button(); this.button16 = new System.Windows.Forms.Button(); this.button15 = new System.Windows.Forms.Button(); this.button14 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();

this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label17 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.button45 = new System.Windows.Forms.Button();

  1   2   3

скачати

© Усі права захищені
написати до нас