77 lines
1.4 KiB
Groovy
77 lines
1.4 KiB
Groovy
|
import java.util.Scanner
|
||
|
|
||
|
class Player {
|
||
|
def name
|
||
|
def gamesSat
|
||
|
}
|
||
|
|
||
|
class Team {
|
||
|
def name
|
||
|
def players
|
||
|
}
|
||
|
|
||
|
def teams = []
|
||
|
def players = [:]
|
||
|
def running = true
|
||
|
def choice
|
||
|
def version="0.1"
|
||
|
def sysin = new Scanner(System.in)
|
||
|
|
||
|
def options=[
|
||
|
ls: ["List Round Information", { list() }],
|
||
|
add: ["Add New Player", { add() }],
|
||
|
win: ["Report Game Result", { gameResult() }]
|
||
|
]
|
||
|
|
||
|
|
||
|
while (running) {
|
||
|
|
||
|
println "==>JDB Team Maker v${version}<=="
|
||
|
options.each { println "(${it[0]}) ${it[1]}" }
|
||
|
|
||
|
choice = sysin.nextLine()
|
||
|
|
||
|
if (options[(choice)])
|
||
|
options.each { opt ->
|
||
|
if (opt[0].toUpperCase().startsWith(choice.toUpperCase()))
|
||
|
opt[1]()
|
||
|
}
|
||
|
|
||
|
println ""
|
||
|
println ""
|
||
|
}
|
||
|
|
||
|
def list() {
|
||
|
|
||
|
println "Current Game:"
|
||
|
println "-------------"
|
||
|
println ""
|
||
|
println "\t${teams[0].name}"
|
||
|
println "\t${'-'.times(teams[0].name.length())}"
|
||
|
teams[0].players.each { println "\t\t$it" }
|
||
|
println ""
|
||
|
println "\t${teams[0].name}"
|
||
|
println "\t${'-'.times(teams[1].name.length())}"
|
||
|
teams[1].players.each { println "\t\t$it" }
|
||
|
|
||
|
println "Remaining Teams:"
|
||
|
println "----------------"
|
||
|
|
||
|
if (teams.length() < 2) return
|
||
|
|
||
|
teams[2..-1].each {
|
||
|
println ""
|
||
|
println "\t${it.name}"
|
||
|
println "\t${'-'.times(it.name.length())}"
|
||
|
it.players.each { println "\t\t$it" }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
def add() {
|
||
|
|
||
|
}
|
||
|
|
||
|
def win() {
|
||
|
|
||
|
}
|