Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 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. else:
  29. self.newGame();
  30. end;
  31.  
  32. end;
  33.  
  34. public def newGame():
  35. io.out -> print("Please enter your name: ");
  36. io.in -> _name;
  37. print("Welcome, {0}!",_name);
  38. end;
  39. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement