/* Percolation animation (version 2.02 - Windows)
 *
 * Copyright (C) 2005 N.R. Moloney 
 *
 * Distributed under the Qt Non-Commercial license version 1.0
 */

#ifndef PERCOLATION_H
#define PERCOLATION_H

#include <qwidget.h>

const int max = 600*600;

class Percolation : public QWidget
{

  Q_OBJECT

public:

  Percolation( QWidget * parent = 0, const char * name = 0 );
  
  bool isolate;
  double p;
  int largest, occ;
  int L;
  int * lattice;
  int * cat;
  int * lar_clu;  

  void callLargest();
  void callSize();

  int initialise_lattice( double p, int * lattice, int * cat, int L );
  int largest_cluster( int * lattice, int * cat, int * lar_clu, 
		       int num_occ, int L );
         
public slots:
    
  void startNew();
  void startL600(); 
  void startL300();
  void startL150();
  void slotIsolate( bool toggle );
  void pChanged( double p_typed );

signals:

  void largestChanged( int );
  void sizeChanged( int );

protected:

  void paintEvent( QPaintEvent * );

};


#endif 
