using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Kod : MonoBehaviour {
int minsayi = 1;
int maxsayi = 100;
int tahmin;
// Start is called before the first frame Update.
void Start() {
print("başlatayım mı? (E/H)");
}
// Update is called once per frame.
void Update() {
if (Input.GetKeyDown(KeyCode.E)) {
print("1-100 arası bir sayı tut");
}
else if (Input.GetKeyDown(KeyCode.H)) {
print("neden hayır dedin!");
}
if (Input.GetKeyDown(KeyCode.Return)) {
Kontrol();
}
if (Input.GetKeyDown(KeyCode.UpArrow)) {
minsayi = tahmin;
tahmin = (minsayi + maxsayi) / 2;
Kontrol();
}
if (Input.GetKeyDown(KeyCode.DownArrow)) {
maxsayi = tahmin;
Kontrol();
}
else if (Input.GetKeyDown(KeyCode.Space)) {
print("buldum");
}
}
void Kontrol() {
tahmin = (minsayi + maxsayi) / 2;
print("tuttuğun sayı " + tahmin + " bu mu? Daha büyük ise yukarı ok, daha küçük ise aşağı ok, doğruysa boşluğa bas");
}
}