io.github.robertograham:rle-parser-module

Jigsaw module to parse RLE files

License

License

GroupId

GroupId

io.github.robertograham
ArtifactId

ArtifactId

rle-parser-module
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

io.github.robertograham:rle-parser-module
Jigsaw module to parse RLE files
Project URL

Project URL

https://github.com/RobertoGraham/RLEParser/tree/rle-parser-module
Source Code Management

Source Code Management

https://github.com/RobertoGraham/RLEParser/tree/rle-parser-module

Download rle-parser-module

How to add to project

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

Dependencies

test (2)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.3.0-M1
org.junit.jupiter : junit-jupiter-params jar 5.3.0-M1

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.0