All pastes #895859 Raw Edit

Untitled

public text v1 · immutable
·published 2008-02-08 03:39 UTC
rendered paste body
public class Joueur 
{
    private final int MAX_X = 81,
                      MIN_X = 0,
                      MAX_Y = 20,
                      MIN_Y = 0;
                      
    private int m_x,
                m_y;
    
    public Joueur() 
    {
        m_x = 1;
        m_y = 1;
    }
    
    public boolean move(int x, int y) 
    {
        boolean ok_x = validerX(x);
        boolean ok_y = validerY(y);
        
        if ( ok_x && ok_y ) 
        {
            m_x = x;
            m_y = y;
        }
        
        return ( ok_x && ok_y );
    }
    
    public int getX() 
    {
        return m_x;    
    }
    
    public int getY() 
    {
        return m_y;       
    }
    
    public boolean validerX(int x) 
    {
        return ( x > MIN_X && x < MAX_X );       
    }
    
    public boolean validerY(int y) 
    {
        return ( y > MIN_Y && y < MAX_Y );
    }

    public static void main(String[] args) 
    {
    }
}