From a71fa52c12a7c99589d3dd59682a1590184552e4 Mon Sep 17 00:00:00 2001 From: HARSHIT JAIN <44135316+iharshit009@users.noreply.github.com> Date: Sat, 29 Jun 2019 16:06:15 +0530 Subject: [PATCH 1/2] kotlin for pydev --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7501f4..be05083 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # KotlinForJavaDev -GDG Indore IO Extended Kotlin Everywhere KotlinForJavaDev +GDG Indore IO Extended Kotlin Everywhere KotlinForJavaDev KotlinForPythonDev From 3d76550bebb1fff5d25f60d4ec8c6807705038ac Mon Sep 17 00:00:00 2001 From: Dhananjay Purohit Date: Sun, 30 Jun 2019 08:09:03 +0530 Subject: [PATCH 2/2] Create Predict.kt --- Number Game/Predict.kt | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Number Game/Predict.kt diff --git a/Number Game/Predict.kt b/Number Game/Predict.kt new file mode 100644 index 0000000..3f2028d --- /dev/null +++ b/Number Game/Predict.kt @@ -0,0 +1,48 @@ +import java.util.Scanner +abstract class Random +fun main(args: Array) { + +// prints new sequence every time + println("1. The computer will think of 3 digit number.") + println("2. You will then guess a 3 digit number") + println("3. The computer will then give back clues, the possible clues are:") + println("") + println("Match: You've guessed a correct number in the correct position") + println("Nope: You haven't guess any of the numbers correctly") + println("4. Based on these clues you will guess again until you break the code with a\n" + + " perfect match, the game will report \"CODE CRACKED\"!") + + println("Lets Start the Game") + val rnds=(100..999).random() +// println(rnds) +var l: Int=0 + do { + var ran:Int =rnds + val num = Integer.valueOf(readLine()) + var num1: Int = num + var rem: Int = 0 + var rem1: Int = 0 + var k: Int = 0 + while (num1 > 0) { + rem = num1 % 10 + num1 /= 10 + rem1 = ran % 10 + ran = ran / 10 + + + if (rem1 == rem) { + k = 1 + } + } + + if (k == 1) { + println("Match") + } + else + println("Nope") + l++ + } while (rnds != num) + println("CODE CRACKED") + println("No. Of Attempts = $l") + +}