[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Heatbug.java question
From: |
David Smith |
Subject: |
Re: Heatbug.java question |
Date: |
Tue, 18 Jan 2000 11:01:29 -0700 (MST) |
On 13 Jan 2000, Marcus G. Daniels wrote:
> >>>>> "DS" == David Smith <address@hidden> writes:
>
> DS> I took a hack at converting the findExtremeType method to return a
> DS> HeatCell, then using the returned cell's coordinates. But it
> DS> crashes after 9 steps with a null pointer exception. I don't know
> DS> why.
>
> The best way to get clarification is to run
> "diff -c Heatbug.java.original Heatbug.java" and post the output.
> Then we have something concrete to talk about.
>
> ==================================
OK, here are the diffs:
from directory myheatbugs:
>diff ../jheatbugs/HeatBug.java HeatBug.java
55c55
<
---
>
60c60
<
---
>
93c93
< public Object setIdealTemperature (long i) {
---
> public void setIdealTemperature (long i) {
95c95
< return this;
---
> // return this;
98c98
< public Object setOutputHeat (long o) {
---
> public void setOutputHeat (long o) {
100c100
< return this;
---
> // return this;
103c103
< public Object setRandomMoveProbability (double p) {
---
> public void setRandomMoveProbability (double p) {
105c105
< return this;
---
> // return this;
117c117
< public Object setX$Y (int inX, int inY) {
---
> public void setX$Y (int inX, int inY) {
121c121
< return this;
---
> // return this;
156c156
< heat.findExtremeType$X$Y (((heatHere < idealTemperature)
---
> HeatCell idealCell = heat.findExtremeType$X$Y (((heatHere <
> idealTemperature)
160,161c160,161
< newX = heatCell.x;
< newY = heatCell.y;
---
> newX = idealCell.x;
> newY = idealCell.y;
AND
from directory myheatbugs:
>diff ../jheatbugs/HeatCell.java HeatCell.java
64c64
< public long findExtremeType$X$Y (int type, HeatCell hc)
---
> public HeatCell findExtremeType$X$Y (int type, HeatCell hc)
126,131c126,128
< // Now we've found the requested extreme. Arrange to return the
< // information (normalize coordinates), and return the heat we found.
<
< hc.setX ((bestCell.getX() + getSizeX()) % getSizeX());
< hc.setY ((bestCell.getY() + getSizeY()) % getSizeY());
<
---
> // Now we've found the requested extreme, return the heat we found.
> // Just return bestCell.
>
135c132
< return getValueAtX$Y (hc.getX(), hc.getY());
---
> return bestCell;
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Heatbug.java question, David Smith, 2000/01/13
- Re: Heatbug.java question, Marcus G. Daniels, 2000/01/13
- Re: Heatbug.java question, David Smith, 2000/01/13
- Re: Heatbug.java question, Marcus G. Daniels, 2000/01/13
- Re: Heatbug.java question, Benedikt Stefansson, 2000/01/13
- Re: Heatbug.java question, David Smith, 2000/01/13
- Re: Heatbug.java question, Marcus G. Daniels, 2000/01/13
- Re: Heatbug.java question,
David Smith <=
- Re: Heatbug.java question, Marcus G. Daniels, 2000/01/18
- Re: Heatbug.java question, David Smith, 2000/01/19
- Re: Heatbug.java question, Marcus G. Daniels, 2000/01/19