Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using 'system.io';
  2.  
  3. public class Main:
  4.  
  5. private string _name;
  6. private bool _hasWon;
  7. private real _health;
  8. private int _treasure;
  9.  
  10. @_name(
  11. set: assertTrue(value != nil);
  12. );
  13.  
  14. @_health(
  15. set: assertTrue(value >= MINIMUM_HP and <= maxHP);
  16. );
  17.  
  18. @_hasWon(
  19. set: assertTrue(value = false);
  20. );
  21.  
  22. public init([string] argv):
  23.  
  24. (if |argv| == 0):
  25. out >> print("No game arguments given, resorting to default.");
  26. self.newGame();
  27. end;
  28.  
  29. else:
  30. self.newGame();
  31. end;
  32.  
  33. end;
  34.  
  35. public def newGame():
  36. io.out >> print("Please enter your name: ");
  37. io.in >> _name;
  38. print("Welcome, {0}!",_name);
  39. end;
  40. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement