Main1.hx 337 B

12345678910111213141516171819202122
  1. class Main {
  2. static final Up = new Point(0, -1);
  3. static final Down = new Point(0, 1);
  4. static function main() {}
  5. function opposite(direction:Point):Point {
  6. return switch (direction) {
  7. case Up: Down;
  8. }
  9. }
  10. }
  11. class Point {
  12. public final x:Int;
  13. public final y:Int;
  14. public function new(x, y) {
  15. this.x = x;
  16. this.y = y;
  17. }
  18. }