A boardgame

From: Linio (Linio_at_seventeen.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 17:06:34 +0100


Hello i know it may sounds stupid, but i'm currently working on a boardgame
on a grid of 20*20 squares and i'd like to write a function to know which
squares are between two square in parameter like this:

public Vector checkBetween(int X1, int Y1, int X2, int Y2);

and by calling it on for example checkBetween(18,6,15,9) in return i have
(17,7) and (16,8).

I tried to figure out a way of doing this by using a polygon but it doesn't
work at all, when i call the function on a straight line (like (15,5) and
(15,10) I have nothing in return when i call the function contains on my
polygon...

I hope I was clear because I ... am clearly not.

If someone could help me out I would appreciate.

Linio.



Relevant Pages

  • Re: mouse event
    ... I made the polygon and then transcoded it ... final int SQUARES = 9; ... public void mousePressed{ ... Make each of your squares separate objects in ...
    (comp.lang.java.help)
  • Problem using AffineTransform
    ... I'm drawing a hexagon in the center of a JPanel. ... squares on each side of the polygon. ... when they should actually transform and map onto the sides of the polygon. ...
    (comp.lang.java.programmer)
  • Re: simple graphics
    ... >haven't had much need for graphics. ... Here's an example vector graphics script using tkinter. ... This is a test version of a polygon editor. ... displays a window with a grid of colored squares. ...
    (comp.lang.python)
  • Re: contiguous polygons question
    ... polygon to any point in another polygon without passing through a ... Now, slightly enlarge all of the White squares, and enlarge the Black squares, so that the single point that was the common boundary between 4 squares becomes a short line segment which is the boundary between two Black squares. ... If you put the representative points for the 4 squares in a configuration where this is impossible - consider that I can construct an arbitrarily large number of similar boundaries - all for the same square. ...
    (comp.graphics.algorithms)
  • Re: A BoardGame
    ... > on a grid of 20*20 squares and i'd like to write a function to know which ... > squares are between two square in parameter like this: ... // get the slope as a double ...
    (comp.lang.java)