Write two methods for the mouse trap game, Game Theory

Assignment Help:

Write two methods for the mouse trap game (using your board created in Assignment 3) and an event handler (another method) to test the two methods.

1. world.raise(item) where raise is a world-level method with one object-type parameter named "item". The method will raise the object item that is passed as the argument. This method will be used to raise obstacles to trap the mouse (or other vermin), so the distance that the object item is raised will depend on the size of the obstacles in your world.

2. mouse.jump(target) where jump is a method for the mouse (or other vermin) object with one object-type parameter named target. The method will cause the mouse to jump from its current position to the target position. You should have the mouse turn in the direction of its jump before jumping so that it is a realistic jump.

3. hw5(item) where hw5 is an event handler to test your methods with one object-type parameter named item. The event handler will respond to the mouse click event as: "When the mouse is clicked on anything do hw5(object_under_mouse_cursor)". The event handler will examine a world-level variable (that you must create) named "count" for conditional execution. If the value of count is 0, then the event handler will call world.raise(item) to raise the object that the user clicked, then set the value of count to 1. If the value of count is 1, then the event handler will call mouse.jump(item) to have the mouse jump to the object that the user clicked, then set the value of
count to 0. In the method that is called when the world starts, set the world-level variable count to 0. Then, when the user first clicks on a place on the board, that place will be raised. When the user next clicks on a place on the board, the mouse (or other vermin) will move to that place. In subsequent clicks, the sequence of raising an obstacle and moving the mouse will repeat. Of course, when the game is finished, there will be testing to make sure that only obstacles are raised and that obstacles are raised only once and the user will not move the mouse, but we are building modules that will be used in the finished game. Thus, you will be able to do things that you will take care of in a future assignment (such as making sure not to raise a cylinder that is already raised, etc).

 

 


Related Discussions:- Write two methods for the mouse trap game

Games with strategic moves, Games with Strat e gic M ov es   ...

Games with Strat e gic M ov es   The ideas in this chapters can be brought to life and the students can better appreciate the subtleties of various strategic moves an

Green –beard strategy, 1  A, Explain how a person can be free to choose but...

1  A, Explain how a person can be free to choose but his or her choices are casually determined by past event 2  B , Draw the casual tree for newcomb's problem when Eve can't pe

Identifying restrictions, In many cases we are interested in only one (or a...

In many cases we are interested in only one (or a few) of the equations of the model and attempts to measure its parameters statistically without a complete knowledge of the entire

English auction, A type of sequential second worth auction during which an ...

A type of sequential second worth auction during which an auctioneer directs participants to beat the present, standing bid. New bids should increase the present bid by a predefine

Reserve worth , A reserve worth is that the minimum acceptable bid in an au...

A reserve worth is that the minimum acceptable bid in an auction. If no bidder submits a bid higher than the reserve worth, the auctioneer keeps the item offered for sale. Alternat

What do you study about saving and investment spending, What do you study a...

What do you study about the saving, investment spending and financial system? Savings, Investment Spending, and the Financial System: 1. The correlation between savings and

Probability and expected utility, PROBABILITY AND EXPECTED UTILITY Most...

PROBABILITY AND EXPECTED UTILITY Most students know the elementary combinatorial rules for probability algebra and need only a refresher with some exam- ples. We have used card

Dominant strategy , Normal 0 false false false EN-US ...

Normal 0 false false false EN-US X-NONE X-NONE

Maximization problem, Two individuals (i ∈ {1, 2}) work independently on a ...

Two individuals (i ∈ {1, 2}) work independently on a joint project. They each independently decide how much e ort ei they put. E ort choice has to be any real number between 0 and

Proxy bidder , A proxy bidder represents the interests of a bidder not phys...

A proxy bidder represents the interests of a bidder not physically gift at the auction. Typically, the bidder can inform his proxy of the most quantity he's willing to pay, and als

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd