From: Gulyas L. <gu...@om...> - 2002-11-16 00:26:03
|
Hi, I'm a bit uncertain as what your question really is, but I'll try to answer it in any case! :-) I found a place in PlaintorGrass.java where you say in a comment that something doesn't work. It worked for me, however. That is, perhaps what it does is not what you intended to do, but it does what you told it to! :-) You have a nested loop that sets all values to 58.0 within a 0..xSize and 0..ySize 'square'. Note, however, that xSize=0 and ySize=0 at that point! So, you set (0,0) to 58.0 and that's what you get. Another point is that when you check the results, you have something like this: System.out.println("x y "+x+y+currentGrass.getValueAt(x,y)); So, assuming x=1, y=1, value at (1,1)=63.0, you get the following: x y 1163.0 Adding spare spaces between the values might clarify the output, as below, but you're perhaps aware of that, too. System.out.println("x y "+x+" "+y+" "+currentGrass.getValueAt(x,y)); Finally, I have a remark on your choice of package name. I hope I'm not offending you or anything, and it's nothing serious either, but a name like uchicago.src.sim.plaintor suggests that the plaintor model is a _part_of_ Repast. In principle, you should be building your own independent package, like 'package plaintor'. Doing the way you do causes no harm in general, except misleading future readers of your code. I also admit that following the example of Repast's demos might not help in this issue... ;-) I hope this helps (I mean, the first part, not the rants on packaging! ;-))! Gulya On Fri, 15 Nov 2002, Daniel Calhoun wrote: > Friends -- I am being baffled by an apparent difference in contexts, > between those where getValueAt works and those where putValueAt works. > Attached are the files for the whole package, which is at a very > preliminary stage, waiting for serious content to be put into the step > methods. > > I suppose there is some subtlety about how scope affects the use of > the grid involved, but it escapes me. The answer may also bear on the > use of the same grid in Value2DDisplay. Is all this affected in any > way by the uses &/or limitations of SimpleModel? > > Thanks much for any enlightenment. > > -- Daniel Calhoun > bus...@so... > > 1) PlaintorModel > > 2) PlaintorAgent > > 3) PlaintorSpace > > 4) PlaintorHunter > > 5) PlainsHerd > > 5) PlainsGrass -- where the bafflement is indicated by a capitalized > comment in the right margin. > -- -- Laszlo Gulyas las...@sz... AI Laboratory http://www.sztaki.hu/~gulyas/ Computer and Automation Research Inst. H-1111, Budapest, Kende u. 13-17. Hungarian Academy of Sciences * 36 1 209-6194 --> On leave at Government Department, Harvard University <-- --> 113b VanSerge, Mails: 34 Kirkland st., Cambridge, MA 02138 <-- --> gu...@fa..., (617) 384-9088 <-- |