Merge pull request #130 from Fs00/master

Make Kotlin version fully equivalent to C# and Java ones
This commit is contained in:
Emily Bache 2019-11-20 11:13:52 +01:00 committed by GitHub
commit 16dd174765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.2.21'
ext.kotlin_version = '1.3.41'
repositories {
mavenCentral()
@ -11,7 +11,7 @@ buildscript {
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.21"
id "org.jetbrains.kotlin.jvm" version "1.3.41"
}
apply plugin: 'kotlin'

Binary file not shown.

View File

@ -1,5 +1,6 @@
#Wed Nov 20 10:18:48 CET 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
zipStoreBase=GRADLE_USER_HOME

View File

@ -4,9 +4,9 @@ class GildedRose(var items: Array<Item>) {
fun updateQuality() {
for (i in items.indices) {
if (!items[i].name.equals("Aged Brie") && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
if (items[i].quality > 0) {
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
items[i].quality = items[i].quality - 1
}
}
@ -14,7 +14,7 @@ class GildedRose(var items: Array<Item>) {
if (items[i].quality < 50) {
items[i].quality = items[i].quality + 1
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") {
if (items[i].sellIn < 11) {
if (items[i].quality < 50) {
items[i].quality = items[i].quality + 1
@ -30,15 +30,15 @@ class GildedRose(var items: Array<Item>) {
}
}
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
items[i].sellIn = items[i].sellIn - 1
}
if (items[i].sellIn < 0) {
if (!items[i].name.equals("Aged Brie")) {
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].name != "Aged Brie") {
if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
if (items[i].quality > 0) {
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
items[i].quality = items[i].quality - 1
}
}

View File

@ -1,3 +1,7 @@
package com.gildedrose
data class Item(var name: String, var sellIn: Int, var quality: Int)
open class Item(var name: String, var sellIn: Int, var quality: Int) {
override fun toString(): String {
return this.name + ", " + this.sellIn + ", " + this.quality
}
}