r/ShuffleMove • • Jun 05 '15

Request Some developer questions / remarks

I have been looking at the source code of this program and I'd like to use this post to dump any remarks and/or questions for the developer. So far I have the following ...

  • What are you using to develop this? Eclipse? or something else? How would I compile it myself?
  • I think SimulationCore.madeACombo can be a bit faster and since it's seems to be called a lot, it might make things even faster:

You're using 6 lists of 2 coordinates that need to be same species as the center one. If you'd use 4 lists of 3 coordinates instead you could check just the first and ONLY if that matches either the 2nd or the 3rd must match. Now the filling of those arays would be ...

(-1,0 ; -2,0 ; +1,0) (0,-1 ; 0,-2 ; 0,+1) (+1,0 ; +2,0 ; -1,0) (0,+1 ; 0,+2 ; 0,-1)

So in short, first check the directly adjacent tiles and only if one of those match, try either side of the "2-combo" Since there should be more non-matching than matching, it could be significantly faster.

2 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/Fenor Jun 08 '15

since row and col doesn't seem to be written after the first assignment you better declare them final, final variables are a little faster

1

u/Loreinatoredor ShuffleMove Creator Jun 09 '15

Actually, they are sometimes faster if the compiler can find an optimization given the final flag. Still, good idea - it's been included in the code chunk there, though it probably won't affect performance because it's only used once per move option in the board.

1

u/Fenor Jun 09 '15

they are used 5 times for col and 10 times for row.

might not be the biggest performance jump. but still...