Hoş Geldiniz!

Sitemize kayıt olarak içerikleri görüntüleyebilirsiniz. Unutmayın ki, sitemize kayıt olmak için 18 yaşından büyük olmanız gerekmektedir.

Hemen Kayıt Ol!
  • Sitemizi 18 YAŞINDAN KÜÇÜKLER KULLANAMAZ! Sitemiz Türkçedir fakat Türkiye'de kullanıma kapalıdır. Üyelikler forum yetkililerince kontrol edilmektedir. Bu web sitesinde Türk Ceza Kanunu'na aykırı hiçbir içerik paylaşılmamaktadır. Müstehcen görüntüler sadece 18 yaşından büyük üyelere gösterilmektedir. Daha fazla bilgi için yasal bilgilendirme metnimizi okuyunuz.

İki Farklı Çiftten Sakso

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace binTOhex_oyunu
{
public partial class Form1 : Form
{
private List<string> hexValues;
private List<string> binaryValues;
private int currentQuestionIndex;
private int score;

public Form1()
{
InitializeComponent();
GenerateQuestions();
}

private void Form1_Load(object sender, EventArgs e)
{
DisplayQuestion();
}

private void GenerateQuestions()
{
hexValues = new List<string>();
binaryValues = new List<string>();
Random rand = new Random();

for (int i = 0; i < 10; i++)
{
uint number = (uint)rand.Next(0, int.MaxValue); // uint için geçerli aralık
string hex = number.ToString("X8"); // 8 basamaklı hex
hexValues.Add(hex); // Hex değeri listeye ekle

// 32 bit binary formatı oluştur
binaryValues.Add(Convert.ToString(number, 2).PadLeft(32, '0')); // 32 bit binary
}
}

private void DisplayQuestion()
{
if (currentQuestionIndex < hexValues.Count)
{
string hex = hexValues[currentQuestionIndex];

// Her bir hex basamağını ayrı bir karakter olarak al
labelQuestion.Text = $"Hex: {string.Join(" ", hex.ToCharArray())}"; // Her bir hex basamağını boşlukla ayır

// Doğru cevap ve yanlış cevaplar için binary değerler
radioButton1.Text = binaryValues[currentQuestionIndex];
radioButton2.Text = GenerateRandomBinary();
radioButton3.Text = GenerateRandomBinary();
radioButton4.Text = GenerateRandomBinary();
}
else
{
MessageBox.Show($"Oyun Bitti! Skor: {score}");
this.Close(); // Oyun bitince formu kapat
}
}

private string GenerateRandomBinary()
{
Random rand = new Random();
uint randomNum = (uint)rand.Next(0, int.MaxValue); // uint için geçerli aralık
return Convert.ToString(randomNum, 2).PadLeft(32, '0');
}

private void btnSubmit_Click_1(object sender, EventArgs e) // Metod adı güncellendi
{
string selectedBinary = "";
if (radioButton1.Checked) selectedBinary = radioButton1.Text;
else if (radioButton2.Checked) selectedBinary = radioButton2.Text;
else if (radioButton3.Checked) selectedBinary = radioButton3.Text;
else if (radioButton4.Checked) selectedBinary = radioButton4.Text;

if (selectedBinary == binaryValues[currentQuestionIndex])
{
score++;
MessageBox.Show("Doğru!");
}
else
{
MessageBox.Show($"Yanlış! Doğru cevap: {binaryValues[currentQuestionIndex]}");
}

currentQuestionIndex++;
DisplayQuestion();
}
}
}
 
Geri
Üst