<tokens>
<keyword> class </keyword>
<identifier> Ball </identifier>
<symbol> { </symbol>
<keyword> field </keyword>
<keyword> int </keyword>
<identifier> x </identifier>
<symbol> , </symbol>
<identifier> y </identifier>
<symbol> , </symbol>
<identifier> r </identifier>
<symbol> , </symbol>
<identifier> hspeed </identifier>
<symbol> , </symbol>
<identifier> vspeed </identifier>
<symbol> ; </symbol>
<keyword> constructor </keyword>
<identifier> Ball </identifier>
<identifier> new </identifier>
<symbol> ( </symbol>
<keyword> int </keyword>
<identifier> lx </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> ly </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> lr </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> lhspeed </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> lvspeed </identifier>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> let </keyword>
<identifier> x </identifier>
<symbol> = </symbol>
<identifier> lx </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> y </identifier>
<symbol> = </symbol>
<identifier> ly </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> r </identifier>
<symbol> = </symbol>
<identifier> lr </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> hspeed </identifier>
<symbol> = </symbol>
<identifier> lhspeed </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> vspeed </identifier>
<symbol> = </symbol>
<identifier> lvspeed </identifier>
<symbol> ; </symbol>
<keyword> return </keyword>
<keyword> this </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> setPos </identifier>
<symbol> ( </symbol>
<keyword> int </keyword>
<identifier> lx </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> ly </identifier>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> erase </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> x </identifier>
<symbol> = </symbol>
<identifier> lx </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> y </identifier>
<symbol> = </symbol>
<identifier> ly </identifier>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> setSpeed </identifier>
<symbol> ( </symbol>
<keyword> int </keyword>
<identifier> lhspeed </identifier>
<symbol> , </symbol>
<keyword> int </keyword>
<identifier> lvspeed </identifier>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> let </keyword>
<identifier> hspeed </identifier>
<symbol> = </symbol>
<identifier> lhspeed </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> vspeed </identifier>
<symbol> = </symbol>
<identifier> lvspeed </identifier>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> draw </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> Screen </identifier>
<symbol> . </symbol>
<identifier> setColor </identifier>
<symbol> ( </symbol>
<keyword> true </keyword>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> do </keyword>
<identifier> Screen </identifier>
<symbol> . </symbol>
<identifier> drawCircle </identifier>
<symbol> ( </symbol>
<identifier> x </identifier>
<symbol> , </symbol>
<identifier> y </identifier>
<symbol> , </symbol>
<identifier> r </identifier>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> erase </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> Screen </identifier>
<symbol> . </symbol>
<identifier> setColor </identifier>
<symbol> ( </symbol>
<keyword> false </keyword>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> do </keyword>
<identifier> Screen </identifier>
<symbol> . </symbol>
<identifier> drawCircle </identifier>
<symbol> ( </symbol>
<identifier> x </identifier>
<symbol> , </symbol>
<identifier> y </identifier>
<symbol> , </symbol>
<identifier> r </identifier>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> update </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> var </keyword>
<keyword> int </keyword>
<identifier> keyPressed </identifier>
<symbol> , </symbol>
<identifier> bLeft </identifier>
<symbol> , </symbol>
<identifier> bRight </identifier>
<symbol> , </symbol>
<identifier> bTop </identifier>
<symbol> , </symbol>
<identifier> bBottom </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> bLeft </identifier>
<symbol> = </symbol>
<identifier> getLeft </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> bRight </identifier>
<symbol> = </symbol>
<identifier> getRight </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> bTop </identifier>
<symbol> = </symbol>
<identifier> getTop </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> bBottom </identifier>
<symbol> = </symbol>
<identifier> getBottom </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> do </keyword>
<identifier> erase </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> if </keyword>
<symbol> ( </symbol>
<identifier> bLeft </identifier>
<symbol> &lt; </symbol>
<integerConstant> 2 </integerConstant>
<symbol> &amp; </symbol>
<identifier> hspeed </identifier>
<symbol> &lt; </symbol>
<integerConstant> 0 </integerConstant>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> invertHspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> if </keyword>
<symbol> ( </symbol>
<identifier> bRight </identifier>
<symbol> &gt; </symbol>
<integerConstant> 508 </integerConstant>
<symbol> &amp; </symbol>
<identifier> hspeed </identifier>
<symbol> &gt; </symbol>
<integerConstant> 0 </integerConstant>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> invertHspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> if </keyword>
<symbol> ( </symbol>
<identifier> bTop </identifier>
<symbol> &lt; </symbol>
<integerConstant> 2 </integerConstant>
<symbol> &amp; </symbol>
<identifier> vspeed </identifier>
<symbol> &lt; </symbol>
<integerConstant> 0 </integerConstant>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> invertVspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> if </keyword>
<symbol> ( </symbol>
<identifier> bBottom </identifier>
<symbol> &gt; </symbol>
<integerConstant> 250 </integerConstant>
<symbol> &amp; </symbol>
<identifier> vspeed </identifier>
<symbol> &gt; </symbol>
<integerConstant> 0 </integerConstant>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> do </keyword>
<identifier> invertVspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> let </keyword>
<identifier> x </identifier>
<symbol> = </symbol>
<identifier> x </identifier>
<symbol> + </symbol>
<identifier> hspeed </identifier>
<symbol> ; </symbol>
<keyword> let </keyword>
<identifier> y </identifier>
<symbol> = </symbol>
<identifier> y </identifier>
<symbol> + </symbol>
<identifier> vspeed </identifier>
<symbol> ; </symbol>
<keyword> do </keyword>
<identifier> draw </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> invertVspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> let </keyword>
<identifier> vspeed </identifier>
<symbol> = </symbol>
<symbol> - </symbol>
<identifier> vspeed </identifier>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> void </keyword>
<identifier> invertHspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> let </keyword>
<identifier> hspeed </identifier>
<symbol> = </symbol>
<symbol> - </symbol>
<identifier> hspeed </identifier>
<symbol> ; </symbol>
<keyword> return </keyword>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> int </keyword>
<identifier> getLeft </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> return </keyword>
<identifier> x </identifier>
<symbol> - </symbol>
<identifier> r </identifier>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> int </keyword>
<identifier> getRight </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> return </keyword>
<identifier> x </identifier>
<symbol> + </symbol>
<identifier> r </identifier>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> int </keyword>
<identifier> getTop </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> return </keyword>
<identifier> y </identifier>
<symbol> - </symbol>
<identifier> r </identifier>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> int </keyword>
<identifier> getBottom </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> return </keyword>
<identifier> y </identifier>
<symbol> + </symbol>
<identifier> r </identifier>
<symbol> ; </symbol>
<symbol> } </symbol>
<keyword> method </keyword>
<keyword> int </keyword>
<identifier> getVspeed </identifier>
<symbol> ( </symbol>
<symbol> ) </symbol>
<symbol> { </symbol>
<keyword> return </keyword>
<identifier> vspeed </identifier>
<symbol> ; </symbol>
<symbol> } </symbol>
<symbol> } </symbol>
</tokens>
