<commit_before>module Levels.Chapter2 where

import Data.Array
import qualified Data.StrMap as SM

import Helper
import Transformer
import Types

chapter2 :: Chapter
chapter2 = {
    name: "Chapter 2",

    transformers: SM.fromList [
        "rejectSizeG2" :> {
            name: "reject(size > 2)",
            function: reject (\x -> length x > 2)
        },
        "mapYtoYR" :> {
            name: "map({Yellow} ↦ {Yellow}{Red})",
            function: tReplaceMultiple Yellow [Yellow, Red]
        },
        "mapCtoRC" :> {
            name: "map({Cyan} ↦ {Red}{Cyan})",
            function: tReplaceMultiple Cyan [Red, Cyan]
        },
        "rejectY" :> {
            name: "reject({Yellow})",
            function: map (reject (== Yellow)) >>> tClearEmpty
        },
        "rejectC" :> {
            name: "reject({Cyan})",
            function: map (reject (== Cyan)) >>> tClearEmpty
        },
        "filterContainsR" :> {
            name: "filter(contains({Red}))",
            function: filter (\stack -> Red `elemIndex` stack /= -1) >>> tClearEmpty
        },
        "mapPushR" :> {
            name: "map(push({Red}))",
            function: map (`snoc` Red)
        },
        "mapReverse" :> {
            name: "map(reverse)",
            function: map reverse
        }
    ],

    levels: SM.fromList [
        "2.1" :> {
            name: "Mercury",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red]]
        },
        "2.2" :> {
            name: "Venus",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red], [Red, Red]]
        },
        "2.3" :> {
            name: "Earth",
            difficulty: Easy,
            initial: [[Cyan, Cyan, Yellow], [Cyan, Red], [Cyan, Red], [Cyan, Cyan, Yellow]],
            target: [[Red, Cyan, Cyan], [Red, Cyan], [Red, Cyan], [Red, Cyan, Cyan]]
        },
        "2.4" :> {
            name: "Mars",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red, Red], [Red, Yellow, Red], [Red, Yellow, Red], [Red, Red, Red]]
        }
    ]
}<commit_msg>Remove unneccesary transformer from chapter 2, new level 2.1<commit_after>module Levels.Chapter2 where

import Data.Array
import qualified Data.StrMap as SM

import Helper
import Transformer
import Types

chapter2 :: Chapter
chapter2 = {
    name: "Chapter 2",

    transformers: SM.fromList [
        "mapYtoYR" :> {
            name: "map({Yellow} ↦ {Yellow}{Red})",
            function: tReplaceMultiple Yellow [Yellow, Red]
        },
        "mapCtoRC" :> {
            name: "map({Cyan} ↦ {Red}{Cyan})",
            function: tReplaceMultiple Cyan [Red, Cyan]
        },
        "rejectY" :> {
            name: "reject({Yellow})",
            function: map (reject (== Yellow)) >>> tClearEmpty
        },
        "rejectC" :> {
            name: "reject({Cyan})",
            function: map (reject (== Cyan)) >>> tClearEmpty
        },
        "filterContainsR" :> {
            name: "filter(contains({Red}))",
            function: filter (\stack -> Red `elemIndex` stack /= -1) >>> tClearEmpty
        },
        "mapPushR" :> {
            name: "map(push({Red}))",
            function: map (`snoc` Red)
        },
        "mapReverse" :> {
            name: "map(reverse)",
            function: map reverse
        }
    ],

    levels: SM.fromList [
        "2.1" :> {
            name: "Mercury",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red], [Red, Red], [Red, Red], [Red, Red]]
        },
        "2.2" :> {
            name: "Venus",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red], [Red, Red]]
        },
        "2.3" :> {
            name: "Earth",
            difficulty: Easy,
            initial: [[Cyan, Cyan, Yellow], [Cyan, Red], [Cyan, Red], [Cyan, Cyan, Yellow]],
            target: [[Red, Cyan, Cyan], [Red, Cyan], [Red, Cyan], [Red, Cyan, Cyan]]
        },
        "2.4" :> {
            name: "Mars",
            difficulty: Easy,
            initial: [[Red, Red], [Red, Yellow], [Cyan, Yellow], [Cyan, Cyan]],
            target: [[Red, Red, Red], [Red, Yellow, Red], [Red, Yellow, Red], [Red, Red, Red]]
        }
    ]
}
{'fraction_non_alphanumeric': 0.17466960352422908, 'fraction_numerical': 0.007048458149779736, 'mean_word_length': 1.7224220623501199, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, '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': '85584', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1441, 'n_words': 376}