class Vector is Sequence{ 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 } toString { return "(%(x)|%(y))" } y0(){ _y = 0 return this } x0(){ _x = 0 return this } iterate(iter){ if(iter == null) return 0 if(iter >= 1) return false return iter + 1 } iteratorValue(iter){this[iter]} [index]{ if(index == 0){ return x } else if(index == 1){ return y } return false } +(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 } }