生命之诗-groovy

class PoetryGroovy { final plans = ["Failed, try again", "Fell down, come on", "Congratulations, keep going"] def random = { new Random().nextInt(it) } def retry = { de ...

生命之诗-shell

#!/bin/sh randNum=0 plans=("Failed, try again" "Fell down, come one" "Congratulations, keep going") function random(){ randNum=$((RANDOM%($1))) } function doPlan(){ next=true ...

生命之诗-go

package main import ( "fmt" "math/rand" "time" ) func random(n int)(int){ rand.Seed(time.Now().UnixNano()) return rand.Intn(n) } func doPlan(){ plans := [3]string{ ...

生命之诗-java

import java.util.Random; public class Poetry { private Random ran; private String[] plans; public Poetry() { ran = new Random(); plans = new String[3]; p ...

生命之诗-node

'use strict' var plans = ['Failed, try again', 'Fell down, come on', 'Congratulation, keep going' ]; var random = function(n) { return Math.floor(Math.random() * (n + 1)); ...