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 generateTimes(numberOfTimes, level, min, max){ | |
//Değişkenlerimiz | |
var times = []; //Hedef zamanlarımızı tutan dizimiz | |
var generatedMsRange = 0; //Son üretilen aralığı tutan değişken | |
var sumOfGeneratedMsRanges = 0; //Rastgele üretilen tüm aralıkların toplamı | |
var minDistanceMs = 0; //Üretilecek aralığın minimum değeri | |
var maxDistanceMs = (max - min) / numberOfTimes; //Üretilecek aralığın maximum değeri | |
for(i = 0; i < numberOfTimes; i++){ |
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 generateTargetTimes(level){ | |
//Sabitlerimiz | |
const initialTimesCount = 6; //Oyun başlangıcındaki hedef zaman sayısı yani minimum hedef sayısı. | |
const minDistanceMs = 200; //Minumum uzaklığı belirleyen sabitimiz. En zor seviyede bile bir sonraki hedefin uzaklığı bu sayıdan büyük olamaz. | |
const gameLifeFactor = 5; //Oyun ömrü bir nevi zorluk derecesidir; ne kadar yüksek olursa o kadar kolay, ne kadar düşük olursa o kadar zor olur. | |
//Değişkenlerimiz | |
var generateTimesCount = (level - (level % 2)) / 2 + initialTimesCount; //Her 2 levelde üretilen sayı miktarını 1 artırıyoruz. | |
var minValueOfRange = Math.floor(minDistanceMs + (minDistanceMs * gameLifeFactor) / level); //İki hedef zaman arasındaki minumum fark. (Level arttıkça değeri küçülür.) | |
var maxValueOfRange = Math.ceil((minDistanceMs * (Math.sqrt(minDistanceMs * gameLifeFactor) / level)) + minValueOfRange); //İki hedef zaman arasındaki maksimum fark. (Level arttıkça değeri küçülür.) |
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
using System; | |
class Program | |
{ | |
//Parametre aldığı kümenin istenen koşulu sağlayıp sağlamadığını kontrol eder. | |
static bool kuraliSagliyorMu(int[] kume) | |
{ | |
//İkili grupların eşitlik kontrolü | |
for (int i1 = 0; i1 < kume.Length; i1++) | |
for (int i2 = i1 + 1; i2 < kume.Length; i2++) |
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
package spiralMatrixPackage; | |
+ | |
+import java.util.Scanner; | |
+ | |
+public class spiralMatrix { | |
+ | |
+ public static void main(String[] args){ | |
+ | |
+ int matrisBoyutu; //Matris boyunu tutacak değişken | |
+ System.out.println("Salyangoz matrisi için boyut giriniz:"); |
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
using System; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Enter dimension for spiral matrix:"); | |
int matrisDim = int.Parse(Console.ReadLine()); | |
int[,] matris = new int[matrisDim, matrisDim]; |
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
public static string cleanString(string inputStr) { | |
if (string.IsNullOrWhiteSpace(inputStr) || string.IsNullOrEmpty(inputStr)) return string.Empty; | |
const char spaceChr = ' '; // this is for readability of the following codes | |
string value = inputStr; //get value of the inputStr into the 'value' variable | |
int length = value.Length; //get length of the value into the 'length' variable | |
char firstChrIterator = '\0', |