We hope the following list of questions and answers is helpful. However, if your question isn't answered below, we want to be sure that you get an answer! Check our help page for for times when help is available and information about other sources of on-line help.
newX = a * oldX + b * oldY newY = c * oldX + d * oldYBased on what we want:
(1,0) -> (0, -1) -> (-1, 0) -> (0,1) -> (1,0)we get
a = 0 b = 1 c = -1 d = 0
Side
can have at
most one listener, which for
our purposes is restricted to being a TetrisBlock
.
Each TetrisBlock
listens to its inducing Side.
When a Side
moves, it needs to notify its listening TetrisBlock
that it has moved. Based on the (probably new) location
of the TetrisBlock
's inducing Side
,
the TetrisBlock
redraws its Side
s. Each of that TetrisBlock
's
Side
s
may itself have a listener, which causes those blocks to move, and so
on.
More specifically, set up your code so that a TetrisBlock
registers itself
with its inducing Side
as a listener. Have a Side
notify its listener
by calling its sideMoved
method.
You have some choices here:
openedUpHallway
return boolean
?
The method returns true
if you decide to open the hallway. The
maze program uses the return value only to determine if it should sleep a while
so you can observe what happened.
points()
in CardList
?
points()
method accordingly.
HandViz
?
HandViz
. When you want to see the player's hand, you need only
call update(CardList)
on the instance variable, passing
in the list of cards to be visualized. If a particular card is not
shown
, then you see only the back of the card.
When the player is done, call close()
on the HandViz
instance variable to make the player's hand go away.
testCanvas
drew objects of different
colors. Check this out in
Startup.java
from Lab 2.
Also, you can take a look at the API for Line
in
cs101's
canvas package.
Or, if you already have the file saved, then open the Project->Edit menu. In their, add the file to the project.
.;C\blah blah blahJust after the first semicolon, insert
P:\cafe151\Java;and then click OK and you should be set. For CEC, just leave the CLASSPATH at its default setting.
Lab3.prj>
, open
Attic.prj
instead. They use the same files but the
environment is set up for the attic. You should be able to switch
back and forth without trouble. In CEC, continue using
the Lab3.prj
.
String sname = "IBM"; Quote oneShare = Lab3.getStockQuote(sname); /* oneShare.getDollars() dollars and oneShare.getEighths() eighths */
int
for the number?
String snum = "101"; int num = Lab3.stringToInt(snum)
Position click()
in
the CS101 Canvas .
DirectionVector
could do this nicely.
If your login name isn't in the list of photos, the CEC consultants may not have downloaded the file yet, so you should check with them. If your name is there, but you don't have permission to see the file, remind the CEC consultants to set the permissions so the file is readable by all. If all else fails, ask a TA for help!