

class Vector {
  x{_x}
  x=(val){_x = val}

  y{_y}
  y=(val){_y = val}

  list{[x, y]}

  construct new(x, y){
    _x = x
    _y = y
  }

  construct new(arg){
    if(arg is Num){
      _x = arg
      _y = arg
    } else {
      _x = arg.x
      _y = arg.y
    }
  }

  construct new(){
    _x = 0
    _y = 0
  }

  floor(){
    _x = _x.floor
    _y = _y.floor
    return this
  }

  invert_x(){
    _x = -_x
    return this
  }

  invert_y(){
    _y = -_y
    return this
  }

  static or_lt(one, other){
    return one.x < other.x || one.y < other.y
  }

  static or_gt(one, other){
    return one.x > other.x || one.y > other.y
  }

  y0(){
    _y = 0
    return this
  }

  x0(){
    _x = 0
    return this
  }
  
  +(other){
    if(other is Num) {
      return Vector.new(x + other, y + other)
    }
    return Vector.new(x + other.x, y + other.y)
  }

  -(other){
    return Vector.new(x - other.x, y - other.y)
  }

  *(other){
    if(other is Vector || other is List){
      return Vector.new(x * other.x, y * other.y)
    }
    if(other is Num) {
      return Vector.new(x * other, y * other)
    }
  }

  /(other){
    if(other is Vector || other is List) {
      return Vector.new(x / other.x, y / other.y)
    }
    if(other is Num) {
      return Vector.new(x / other, y / other)
    }
  }

  %(other){
    if(other is Vector || other is List) {
      return Vector.new(x % other.x, y % other.y)
    }
    if(other is Num) {
      return Vector.new(x % other, y % other)
    }
  }

  <(other){
    return x < other.x && y < other.y
  }

  >(other){
    return x > other.x && y > other.y
  }
}