56e @verb #9595:"resolve_match" this none this rxdo #8034 @program #9595:"resolve_match" this none this "Announces to the room the results of two throws." " Pass it a list of {player, move} pairs. " " Currently no logic in place to determine the winner. " here = player.location {throw1, throw2} = args {player1, move1} = throw1 {player2, move2} = throw2 here:announce_all(player1:titlec(), " throws ", move1, "; ", player2:title(), " throws ", move2, ".") " OK.... should I bother programming a generalized version so that someday this object might serve games with more than three players, a la Sissyfight?" " anyway, for now, a quick two-player version. " winner1 = $list_utils:assoc({move1, move2}, this.rules) winner2 = $list_utils:assoc({move2, move1}, this.rules) script = 0 if (winner1) {moves, script, ?predicate = "beats"} = winner1 {winner, loser} = {player1, player2} elseif (winner2) {moves, script, ?predicate = "beats"} = winner2 {winner, loser} = {player2, player1} else {winner, loser} = {player1, player2} endif if (!script) if (winner1 || winner2) script = tostr(moves[1], " ", predicate, " ", moves[2], ". %N %!") else script = "The match ends in a draw!" endif endif dobj = loser $you:say_action(script, winner, this, winner.location) "Last modified by Pentomino (#8034) on Tue Aug 31 22:50:16 2004 MDT." . 0