io.github.robertograham:rle-parser

Parses RLE files

License

License

GroupId

GroupId

io.github.robertograham
ArtifactId

ArtifactId

rle-parser
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

io.github.robertograham:rle-parser
Parses RLE files
Project URL

Project URL

https://github.com/RobertoGraham/RLEParser
Source Code Management

Source Code Management

https://github.com/RobertoGraham/RLEParser/tree/master

Download rle-parser

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.robertograham/rle-parser/ -->
<dependency>
    <groupId>io.github.robertograham</groupId>
    <artifactId>rle-parser</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.robertograham/rle-parser/
implementation 'io.github.robertograham:rle-parser:1.0.1'
// https://jarcasting.com/artifacts/io.github.robertograham/rle-parser/
implementation ("io.github.robertograham:rle-parser:1.0.1")
'io.github.robertograham:rle-parser:jar:1.0.1'
<dependency org="io.github.robertograham" name="rle-parser" rev="1.0.1">
  <artifact name="rle-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.robertograham', module='rle-parser', version='1.0.1')
)
libraryDependencies += "io.github.robertograham" % "rle-parser" % "1.0.1"
[io.github.robertograham/rle-parser "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
com.intellij : annotations jar 9.0.4

Project Modules

There are no modules declared in this project.

Maven Central

RLEParser

Reads Game of Life .rle files

Install

<dependency>
    <groupId>io.github.robertograham</groupId>
    <artifactId>rle-parser</artifactId>
    <version>1.0.1</version>
</dependency>

Usage

glider.rle

#C This is a glider.
x = 3, y = 3
bo$2bo$3o!
import io.github.robertograham.rleparser.RleParser;
import io.github.robertograham.rleparser.domain.LiveCells;
import io.github.robertograham.rleparser.domain.PatternData;

import java.net.URISyntaxException;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) throws URISyntaxException {
        PatternData patternData = RleParser.readPatternData(Main.class.getClassLoader().getResource("glider.rle").toURI());

        System.out.println(IntStream.range(0, patternData.getMetaData().getHeight())
                .mapToObj(patternData.getLiveCells()::filteredByY)
                .map(filteredByY -> IntStream.range(0, patternData.getMetaData().getWidth())
                        .mapToObj(filteredByY::filteredByX)
                        .map(LiveCells::getCoordinates)
                        .map(coordinates -> coordinates.size() == 0 ? "." : "@")
                        .collect(Collectors.joining()))
                .collect(Collectors.joining("\n")));
    }
}

Prints:

.@.
..@
@@@

Versions

Version
1.0.1
1.0.0