// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Pentris.java

import java.awt.Graphics;
import javax.swing.JPanel;

class Score extends JPanel
{

    public Score()
    {
        score = 0;
    }

    public void addPoints(int i)
    {
        score += i;
    }

    public void resetScore()
    {
        score = 0;
    }

    public boolean isPerfect()
    {
        return score == 0x15f90;
    }

    public void paintComponent(Graphics g)
    {
        int i = score;
        for(int j = 0; j < 6; j++)
        {
            int k = i % 10;
            int l = (5 - j) * (W + B);
            g.translate(l, 0);
            for(int i1 = 0; i1 < 7; i1++)
                if(digits[k][i1] == 1)
                    g.fillPolygon(segmentsX[i1], segmentsY[i1], 4);

            g.translate(-l, 0);
            i /= 10;
        }

    }

    int score;
    static int W;
    static int H;
    static int B;
    static final int digits[][] = {
        {
            1, 1, 1, 1, 1, 1, 0
        }, {
            0, 1, 1, 0, 0, 0, 0
        }, {
            1, 1, 0, 1, 1, 0, 1
        }, {
            1, 1, 1, 1, 0, 0, 1
        }, {
            0, 1, 1, 0, 0, 1, 1
        }, {
            1, 0, 1, 1, 0, 1, 1
        }, {
            1, 0, 1, 1, 1, 1, 1
        }, {
            1, 1, 1, 0, 0, 0, 0
        }, {
            1, 1, 1, 1, 1, 1, 1
        }, {
            1, 1, 1, 1, 0, 1, 1
        }
    };
    static final int segmentsX[][];
    static final int segmentsY[][];

    static 
    {
        W = 10;
        H = 10;
        B = 2;
        segmentsX = (new int[][] {
            new int[] {
                0, W, W, 0
            }, new int[] {
                W, W, W - B, W - B
            }, new int[] {
                W, W, W - B, W - B
            }, new int[] {
                W, 0, 0, W
            }, new int[] {
                0, 0, B, B
            }, new int[] {
                0, 0, B, B
            }, new int[] {
                0, W, W, 0
            }
        });
        segmentsY = (new int[][] {
            new int[] {
                0, 0, B, B
            }, new int[] {
                0, H, H, 0
            }, new int[] {
                H, 2 * H, 2 * H, H
            }, new int[] {
                2 * H, 2 * H, 2 * H - B, 2 * H - B
            }, new int[] {
                2 * H, H, H, 2 * H
            }, new int[] {
                H, 0, 0, H
            }, new int[] {
                H - B / 2, H - B / 2, H + B / 2, H + B / 2
            }
        });
    }
}
