<commit_before>package nars.grid2d;

import nars.grid2d.Cell.Logic;

public class Cell {
    
    public float light=0.0f;
    public float charge = 0;
    public float value=0;
    public float value2=0;
    public float conductivity = 0.98f;
    public boolean chargeFront = false;
    public float height = 0;
    public Material material;
    public Logic logic;
    public final CellState state;
    public boolean is_solid=false;
    
    public boolean isSolid() {
        return is_solid;
    }

    public enum Material {
        DirtFloor,
        StoneWall,
        Corridor,
        Door, 
        Empty, DirtWall,
        Machine
        //case Tile.Upstairs:
        //case Tile.Downstairs:
        //case Tile.Chest:        
    }
    
    public enum Logic {
        NotALogicBlock,
        AND,
        OR,
        XOR,
        NOT,
        BRIDGE,
        SWITCH,
        OFFSWITCH,
        WIRE, 
        Load     
    }
    
    public enum Machine {
        Light,
        Turret
    }
    
    public Machine machine;
    
    public Cell() {
        this(new CellState(0, 0));
    }
    
    public Cell(CellState state) {
        this.state = state;
        
        height = 64;
        material = Material.Empty;
        logic=Logic.NotALogicBlock;
        machine = null;
        
        charge=-0.5f; //undefined charge by default
    }
    

    public void setHeightInfinity() {
        height = Float.MAX_VALUE;
        material = Material.StoneWall;
    }
    
    public void drawtext(Grid2DSpace s, String str) {
        s.pushMatrix();
        s.fill(255,255,255,128);
        s.translate(0.2f,0.9f);
        s.text(str,0,0);
        s.popMatrix();
    }
    
    public static float lerp(float current, float next, float speed) {
        return current * (1.0f - speed) + next * (speed);
    }    
    
    
    public void draw(Grid2DSpace s,boolean edge) {

        int ambientLight = 100;
        
        //draw ground height
        int r=0,g=0,b=0,a=1;
        a = ambientLight;            
         
        if (material == Material.Empty) {
        }
        else if (material == Material.Machine) {
            g = b = 127;
            r = 200;
        }
        else if (material == Material.StoneWall || (material==Material.Door && is_solid)) {
            r = g = b = 255;
        }
        else if (material == Material.DirtFloor || (material==Material.Door && !is_solid)) {
            if (height == Float.MAX_VALUE) {
                r = g = b = 255;
            }
            else { 
                r = g = b = (int)(128 + height);
            }           
        }
        if(material==Material.Door  && is_solid) {
            b=0;
            g=(int) (g/2.0f);
        }
        if(material==Material.Door) {
            r=200;
        }
        if ((charge>0) || (chargeFront)) {
            {
                float freq = 4;
                int chargeBright = (int)((Math.cos(s.getRealtime()*freq)+1) * 25);

                if (charge > 0) {
                    r += chargeBright;
                    g += chargeBright/2;                    
                }
                else {
                    g += chargeBright;
                    r += chargeBright/2;
                }
                if (chargeFront) {
                    freq = 7;
                    b += 25;
                }
                a += 150;

            }
        }<commit_msg>single commit retry<commit_after>package nars.grid2d;

import nars.grid2d.Cell.Logic;

public class Cell {
    
    public float light=0.0f;
    public float charge = 0;
    public float value=0;
    public float value2=0;
    public float conductivity = 0.98f;
    public boolean chargeFront = false;
    public float height = 0;
    public Material material;
    public Logic logic;
    public final CellState state;
    public boolean is_solid=false;
    
    public boolean isSolid() {
        return is_solid;
    }

    public enum Material {
        DirtFloor,
        StoneWall,
        Corridor,
        Door, 
        Empty, DirtWall,
        Machine
        //case Tile.Upstairs:
        //case Tile.Downstairs:
        //case Tile.Chest:        
    }
    
    public enum Logic {
        NotALogicBlock,
        AND,
        OR,
        XOR,
        NOT,
        BRIDGE,
        SWITCH,
        OFFSWITCH,
        WIRE, 
        Load     
    }
    
    public enum Machine {
        Light,
        Turret
    }
    
    public Machine machine;
    
    public Cell() {
        this(new CellState(0, 0));
    }
    
    public Cell(CellState state) {
        this.state = state;
        
        height = 64;
        material = Material.Empty;
        logic=Logic.NotALogicBlock;
        machine = null;
        
        charge=-0.5f; //undefined charge by default
    }
    

    public void setHeightInfinity() {
        height = Float.MAX_VALUE;
        material = Material.StoneWall;
    }
    
    public void drawtext(Grid2DSpace s, String str) {
        s.pushMatrix();
        s.fill(255,255,255,128);
        s.translate(0.2f,0.9f);
        s.text(str,0,0);
        s.popMatrix();
    }
    
    public static float lerp(float current, float next, float speed) {
        return current * (1.0f - speed) + next * (speed);
    }    
    
    
    public void draw(Grid2DSpace s,boolean edge) {

        int ambientLight = 100;
        
        //draw ground height
        int r=0,g=0,b=0,a=1;
        a = ambientLight;            
         
        if (material == Material.Empty) {
        }
        else if (material == Material.Machine) {
            g = b = 127;
            r = 200;
        }
        else if (material == Material.StoneWall || (material==Material.Door && is_solid)) {
            r = g = b = 255;
        }
        else if (material == Material.DirtFloor || (material==Material.Door && !is_solid)) {
            if (height == Float.MAX_VALUE) {
                r = g = b = 255;
            }
            else { 
                r = g = b = (int)(128 + height);
            }           
        }
        if(material==Material.Door  && is_solid) {
            b=0;
            g=(int) (g/2.0f);
        }
        if(material==Material.Door) {
            r=200;
        }
        if ((charge>0) || (chargeFront)) {
            {
                float freq = 4;
                int chargeBright = (int)((Math.cos(s.getRealtime()*freq)+1) * 25);

                if (charge > 0) {
                    r += chargeBright;
                    g += chargeBright/2;                    
                }
                else {
                    g += chargeBright;
                    r += chargeBright/2;
                }
                if (chargeFront) { 
                    freq = 7;
                    b += 25;
                }
                a += 150;

            }
        }
{'fraction_non_alphanumeric': 0.10293902617341717, 'fraction_numerical': 0.023980114051761953, 'mean_word_length': 1.1993569131832797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4307921', 'n_tokens_mistral': 2168, 'n_tokens_neox': 2001, 'n_words': 472}