Module: Api::Result

Defined in:
lib/sc2ai/protocol/sc2api_pb.rb

Constant Summary collapse

ENUM_RESULT_UNSET =
0
VICTORY =
1
DEFEAT =
2
TIE =
3
UNDECIDED =
4

Class Method Summary collapse

Class Method Details

.lookup(val) ⇒ Object



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 328

def self.lookup(val)
  if val == 0
    :ENUM_RESULT_UNSET
  elsif val == 1
    :VICTORY
  elsif val == 2
    :DEFEAT
  elsif val == 3
    :TIE
  elsif val == 4
    :UNDECIDED
  end
end

.resolve(val) ⇒ Object



342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 342

def self.resolve(val)
  if val == :ENUM_RESULT_UNSET
    0
  elsif val == :VICTORY
    1
  elsif val == :DEFEAT
    2
  elsif val == :TIE
    3
  elsif val == :UNDECIDED
    4
  end
end