6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ズンドコキヨシ with Gradle

Last updated at Posted at 2016-03-14

Gradleでズンドコキヨシやってみた!

ロジックはほぼJava。ちょっとGradle

build.gralde
defaultTasks 'zundoko'

task kiyoshi << {
    println 'キ・ヨ・シ!'
}

task zundoko << {
    description 'zundoko kiyoshi task.'
    int zun = 0
    while (true) {
        int random = (int) (Math.random() * 2)
        print random == 0 ? 'ズン' : 'ドコ'
        print ' '
        switch (random) {
            case 0:
                zun++
                break
            case 1:
                if (zun > 4) {
                    tasks.kiyoshi.execute()
                    return
                }
                zun = 0
        }
    }
}

defaultTaskszundokoにしてるので実行はgraldeだけでもOK。

➜  zundoko gradle
:zundoko
ドコ ズン ズン ドコ ズン ズン ドコ ズン ドコ ズン ズン ズン ズン ズン ズン ドコ キ・ヨ・シ!

BUILD SUCCESSFUL

Total time: 4.299 secs

一応Githubにもあげておいた。

葛藤

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?