\chapter{Methodology}

In this chapter, we describe the methodology of our proposed Android malware detection system based on static features and how we implemented our models using our proposed Stacking method.

\section{Dataset} \label{dataset}

To begin with this Chapter we will introduce the dataset used in this paper. We used a dataset called Androzoo.
AndroZoo is a growing collection of Android Applications collected from several sources, including the official Google Play app market.
It currently contains 10,299,119 different APKs, each of which has been (or will soon be) analyzed by tens of different AntiVirus products to know which applications are detected as Malware\cite{androzoo}.

Due to keeping a balanced dataset containing both malware and benignware samples,
We collected 10,000 malware \ac{apk}s and 10,000 benignware samples randomly from the above dataset Androzoo. Also, we have done a filtering process in which we remove repeated applications and those that are considered as invalid (they cannot be actually installed and executed). After removing these applications we download again the remaining number to complete 10,000 of \ac{apk}s and done the filtering process again. We repeated these steps until to gather a clean dataset consisted of 10,000 \ac{apk}s of malware applications and 10,000 \ac{apk}s of benignware applications with a total of 20,000 \ac{apk}s.

\section{Static Features extraction} \label{extractedvector}

Static features focus on a large part of the state-of-the-art literature related to Android malware
detection. The easy and quick extraction of this kind of feature makes them suitable to be used to build malware detection tools.

One of our system goals is to do a prediction process while the user only needs to input the \ac{apk} file to receive the output (malware or not). In other words, it is called an end-to-end system. One essential process to achieve this goal is, we have to automatically the feature extraction process and convert it to vectors that the machine learning models could use for inputs to predict something.
So in this study, we use an opensource tool called AndroPytool \cite{andropytool}.

AndroPyTool can extract static and dynamic features, this section focuses on the
former ones. By using Android malware analysis tools such as AndroGuard or by analyzing the source code of each sample, AndroPyTool extracts a representative set of characteristics based on　state-of-the-art Android malware detection approaches. These features include API calls, main　activity name, opcodes, package name, permissions, intent receivers, intents services, intent activities, strings found, system commands or information flows extracted with FlowDroid.

Once extracted the desired set of characteristics, such as permissions requested, API calls
invoked or information flows, all this information is processed to build a representative feature
vector for each application. This process is shown in Fig. \ref{fig:featurevector} On the one hand, $M$ measurable
characteristics $$ C_{M}=\left\{c_{1}, c_{2}, \ldots, c_{M}\right\} $$ are assigned a value counting the number of occurrences of
that feature within the application. On the other hand, $K$ binary features $$
D_{K}=\left\{d_{1}, d_{2}, \ldots, d_{K}\right\}
$$
point the use or the existence of a particular attribute. The bundling of both features composes
the static description of the application behavior, in other words, our input dataset $\mathcal{D}$.
$$
\mathcal{D}=\left\{\mathbf{x}_{i}, y_{i}\right\} \text{where }
\mathbf{x}_{i}=\left\{c_{1,}^{i} c_{2}^{i}, \ldots, c_{M}^{i}, d_{l,}^{i}, d_{2}^{i}, \ldots, d_{K}^{i}\right\}
$$

\begin{figure}[htbp]
    \centering
    \includegraphics[scale=0.68]{./Figure/featurevector.png}
    \caption{Extraction and representation of static information into representative feature vectors. \cite{andropytool}}
    \label{fig:featurevector}
\end{figure}

\section{Stacking}
Stacking is an ensemble learning technique that combines multiple classifications or regression models via a meta-classifier or a meta-regressor \cite{stackingref}. The base level models are trained based on a complete training set, then the meta-model is trained on the outputs of the base level model like features as we can see in Figure \ref{fig:stacking}.

\begin{figure}[htbp]
    \centering
    \includegraphics[width=\textwidth]{./Figure/stacking.png}
    \caption{Stacking pipeline figure.}
    \label{fig:stacking}
\end{figure}

The base level often consists of different learning algorithms and therefore stacking ensembles are often heterogeneous. But we must note that this type of Stacking is prone to overfitting due to information leakage. We should not derive the predictions for the 2nd-level classifier from the same dataset that was used for training the level-1 classifiers. The algorithm \ref{alg:algo1} summarizes stacking.

\begin{algorithm}[htbp]
    \centering
    \caption{Stacking}
    \label{alg:algo1}
    \begin{algorithmic}[1]
    \renewcommand{\algorithmicrequire}{\textbf{Input:}}
    \renewcommand{\algorithmicensure}{\textbf{Output:}}
    \Require Training data $\mathcal{D}=\left\{\mathbf{x}_{i}, y_{i}\right\}_{i=1}^{m}\left(\mathbf{x}_{i} \in \mathbb{R}^{n}, y_{i} \in \mathcal{Y}\right)$
    \Ensure An ensemble classifier $H$
    \State Step 1: Learn first-level classifiers
    \For{$t\gets$ 1 to $T$}
        \Statex Learn a base classifier $h_{t}$ based on $\mathcal{D}$
    \EndFor
    \State Step 2: Construct new data sets from $\mathcal{D}$
    \For{$i = 1$ to $m$}
    \State $\text{Construct a new data set }\mathcal{D}_{h}=\left\{\mathbf{x}_{i}^{\prime}, y_{i}\right\}, \text { where } \mathbf{x}_{i}^{\prime}=\left\{h_{1}\left(\mathbf{x}_{i}\right), \ldots, h_{T}\left(\mathbf{x}_{i}\right)\right\}$
    \EndFor
    \State Step 3: learn a meta-classifier
    \State Learn a new classifier $h^{\prime}$ based on the newly constucted data set $\mathcal{D}_h$
    \State \textbf{return} $H(\mathbf{x})=h^{\prime}\left(\mathcal{D}_h\right)$
    \end{algorithmic}
\end{algorithm}

Besides, Stacking is a commonly used technique for winning the Kaggle data science competition. For example, the first place for the Otto Group Product Classification challenge was won by a stacking ensemble of over 30 models whose output was used as features for three meta-classifiers: XGBoost, Neural Network, and Adaboost.

\section{Proposed model pipeline} \label{model}

In this section, we will introduce the main topic of our system, the Stacking model pipeline as we can see in Figure\ref{fig:modelpipeline}. Our proposed model consists of 3 stages with different models to predict one final output.

\begin{figure}[htbp]
    \centering
    \includegraphics[width=\textwidth]{./Figure/modelpipeline.png}
    \caption{Proposed Stacking model pipeline figure.}
    \label{fig:modelpipeline}
\end{figure}

\subsection{1st Stage}
For this first stage, we proposed to train 7 different algorithms (Bagging, XGBoost, K-neighbors, LogisiticRegression, RandomForest NeuralNetworks) to each 7 different static feature (Activities, API calls, Opcodes, Permissions, Receivers, Services, System commands) to create our models of a total of 49 models.

Following the Algorithm \ref{alg:algo1}, we trained the base 49 classifiers $h_{t=49}$ on our training dataset as mentioned in section \ref{dataset}. Where our input training data is $\mathbf{x}_{i}$ and label data is $y_{i}$
 $$\left\{\mathbf{x}_{i}, y_{i}\right\}_{i=1}^{m=7}\left(\mathbf{x}_{i} \in \mathbb{R}^{n}, y_{i} \in \mathcal{Y}\right)$$

Due to every model has one output for one \ac{apk} input, we gain one output vector from $\mathcal{D}$ as we can see at below $$\mathcal{D}_h = \left\{\mathbf{x}_{i}^{\prime}, y_{i}\right\}, \text { where } \mathbf{x}_{i}^{\prime}=\left\{h_{1}\left(\mathbf{x}_{i}\right), \ldots, h_{T=49}\left(\mathbf{x}_{i}\right)\right\}$$

\subsection{2nd Stage}
In this stage, we proposed to train 4 different algorithms (Neural Network, Logistic Regression classifier, Linear SVC, RandomForest) with the output vector from the 1st stage as input data.
Following the Algorithm \ref{alg:algo1}, we train our 2nd stage meta-classifiers $H_{k}$($k=4$) based on the newly constructed data set at 1st stage $\mathcal{D}_h$. Then we obtained the below models $H_{k}$
$$H_{k}(\mathbf{x})=h^{\prime}\left(\mathcal{D}_h\right)$$

\subsection{3rd Stage}
In this stage, we repeated the 2nd stage process using $H_{k}\left(\mathbf{x}\right)$ as input to train our final meta-classifier (Linear SVC).

We trained our final meta-classifier $L$ based on the newly constructed dataset at 2nd stage $\mathcal{D}_l = \left\{\mathbf{h}_{i}^{\prime}, y_{i}\right\}$. Then we obtain the below trained final meta-classifier $L\left(\mathbf{x}\right)$
$$L(\mathbf{x})=l^{\prime}\left(H_{1}(\mathbf{x}), H_{2}(\mathbf{x}), \ldots, H_{k}(\mathbf{x})\right)$$

\section{Proposed Malware detection System}
In this section, we introduce our proposed malware detection system implementing our proposed Stacking model in section \ref{model}. We can see the overview of our proposed system pipeline in Figure \ref{fig:systempip}.

\begin{figure}[htbp]
    \centering
    \includegraphics[width=\textwidth]{./Figure/systempip.png}
    \caption{Proposed malware detection system pipeline figure.}
    \label{fig:systempip}
\end{figure}

\subsection{AndroPytool module}

We build almost all of this system in a Linux Docker container. The main merit of building a system with Docker is that it makes easy for the users to deploy this system in other environments not needing to care about dependent packages.

First, we implemented the AndroPyTool\cite{andropytool} module. Here we input the APK file to extract the static features to our database as \ac{csv} file, as we can see in section \ref{extractedvector}.

\subsection{Preprocessing data}

Next, we load the extracted features from our database to our python module.
In this module, we preprocess our data (static features in vectors) before to input it into our classifier model. We applied two steps to preprocess our data.

\subsubsection{Standard scaling}
In the first step, we applied the Standard scaling to all of our counter-based features. Below is the formula applied for Standard scaling.

$$x^{\prime}=\frac{x-\bar{x}}{\sigma}$$

Where $x$ is the original feature vector, $\bar{x}=average(x)$ is the mean of that feature vector, and $\sigma$ is its standard deviation.

\subsubsection{One-hot encoding}
For the second step, we applied One hot encoding method to our categories features or binary features.
One hot encoding is a process by which categorical variables are converted into a form that could be provided to ML algorithms to do a better job in prediction.
The figure \ref{fig:onehotexample} explain the One hot encoding process. In this example, we applied One hot encoding to the CompanyName collum. After converting the CompanyName to CategoricalValue it is converted to binary values.

\begin{figure}[htbp]
    \centering
    \includegraphics[width=\textwidth]{./Figure/onehotexample.png}
    \caption{One hot encoding explained in an image.}
    \label{fig:onehotexample}
\end{figure}

\subsection{Prediction of malware}

After preprocessing our data to the best format for all of our classifiers, finally, we do the malware prediction step.
We input the preprocessed data to the 49 models as mentioned in section \ref{model}.
After the 3 steps of prediction, the final classifier outputs the final prediction (0 for Benign app, 1 for Malware app).


% !TEX root = ../00_thesis.tex

%-------------------------------------------------------------------------------
\section{Implementation and Scalability of \triscale}
\label{sec:triscale_implementation}
%-------------------------------------------------------------------------------

%-------------------------------------------------------------------------------
\subsection{Python Package}

We implement \triscale in Python ($\approx$1000 lines of code) and make it open source~(\cref{append:triscale_artifacts}).
\triscale's API contains one function for each timescale of the data analysis; \ie the computation of metrics, KPIs, and variability scores.
Docstrings contain detailed information about the functions usage.
Our implementation relies on standard scientific packages such as NumPy~\cite{numpy}, Pandas~\cite{pandas}, SciPy~\cite{scipy}.
As the use of non-parametric statistics is not (yet) widespread, we had to implement some of the statistics used by \triscale (in particular the computation of CI using Thompson's method).
We hope to see these functions integrated in a future release of SciPy.

\squarepar{%
  It is important to produce useful visualizations to support the experimenter.
  Thus, we paid a particular attention to the plotting functions in \triscale.
  \triscale uses Plotly~\cite{plotly} to create interactive plots: one can zoom in and out in the plots, toggle the visibility of individual traces, read data point values on hover, \etc
  All the plots in this chapter are produced using \triscale and are ``clickable'': figures are hyperlinks leading to dynamic versions of the plots.%
}

%-------------------------------------------------------------------------------
\subsection{Scalability of \triscale Data Analysis}
\label{subsec:scalability}

We evaluate the scalability of \triscale with respect to computation time; \ie how does the data analysis time scales with increasing input sizes.
We only consider the time required for performing computations; other outputs such as logs and plots (\eg \Cref{fig:analysis_metric}) are excluded.
The complete scalability evaluation (including data, plots, and discussions) is available as complementary materials~(\cref{append:triscale_artifacts}).
Generally, the computation time for the data analysis in \triscale scales linearly with the input size~(\Cref{table:scalability}): it is fast (less than 1\s for one million data points on a commodity laptop) and overall negligible compared to the data collection time.

\begin{table}
    \centering
    \caption{Scalability evaluation.
    \capt{\triscale data analysis is fast and scales well with increasing input sizes. The most time-consuming element is the convergence test~(\cref{subsec:test_convergence}) which is performed before the computation of metrics. Still, it generally takes less than one second for inputs (\ie the number of raw measurements in a run) of up to one million data points.}}
    \input{\PathTab/triscale_scalability.csv}
    \label{table:scalability}
\end{table}


%!TEX root = ../gronskiy_phd_thesis.tex
\chapter{Concluding Remarks}
\label{ch:conclusion}

\hfill
\begin{minipage}[t]{.75\textwidth}
\textit{``The measure of greatness in a scientific idea is the extent to which
it stimulates thought and opens up new lines of research.''} \\
  \hrule
  \vspace{.2cm}
  \hfill
  \textsc{---  Paul DIRAC}
\end{minipage}
\\[.5cm]

In this thesis, we addressed the problem of robust approximate optimization in
different settings: general, algorithmic and thermodynamic, and also looked into
the thermodynamic behavior of optimization problem in a more general (i.e. not
related to approximation) sense. Because detailed remarks are given at the end
of each chapter, here we give some very general thoughts about possible
directions of the further research.

\section{Approximate Optimization in General}

It would be interesting to extend the approaches presented in
Chapter~\ref{ch:gen_appch} to the case of more than two instances.
While some straightforward generalizations may exist~--- e.g. mechanistically
extend the formula for ASC score, adding more terms in nominator and
denominator,~--- it becomes unclear how to justify it from the point of view of
coding theory. It can require modifying the definition of the channel which
we presented in that chapter.

Further, while we partially addressed the question of computing intersection
cardinalities, this result relies on knowing distributions, which renders it
unusable in practice or at least requires the use of plug-in estimators. It
would be beneficial to design a class of problems for which this issue
is eliminated. We partially did this for algorithmic problems, but at the cost
of worse performance, as noted in the discussion of that chapter.

Last but not least, there is hope that one can integrate our approach into a
toolbox of stability-related approaches (see related work), because our approach
essentially attacks the problem of identifying stability conditions (by imposing
approximations). It would be interesting to see a connection of our approach
with more conventional techniques.

\section{Robust Algorithmic Optimization}

As we have seen, the ASC score establishes a ranking of algorithms, which also
yields a corresponding ranking of their localization errors. Is this by chance or
can it be proven rigorously? Another question here arises. The
Reverse-Delete algorithm requires many more steps than Prim's and Kruskal's (see
experiments in Chapter~\ref{ch:mst}), but gains much better robustness.
Obviously, this happens because Reverse-Delete is much more elaborate in
exploring the graph: Prim's and Kruskal's algorithms eliminate unexplored edges
much more aggressively, and thus ``skip'' a lot of opportunities without
actually seeing them. We have a clear runtime vs. robustness trade-off, which
raises a question: can one construct an intermediate algorithm using the above
three as building blocks?

Another massive task would be to study more algorithmic problems from this
perspective. It must be recalled that the extension of ASC for algorithms was
performed in some sense ``blindly'', since proving the communication error
bounds (in analogy to that of Chapter~\ref{ch:gen_appch}) is hard in this case.
Consequently, it might turn out that with other algorithmic problems this
approach works much better/worse. Additional research would be beneficial here.

\section{Thermodynamic Behavior of Optimization Problems}

Although we have proven (Chapter~\ref{ch:free_energy}) the asymptotics of free
energy in two specific cases, we still did not devise a general
methodology. Although we are currently under an impression that there is no such
general methodology, more attempts should be made.

Next, we made and experimentally backed up an attractive conjecture about the
behavior of free energy in more general cases than those where
theoretic results were obtained. We brought up an intuitive explanation for it,
and it is extremely interesting to continue a line of research on that.

Further, it is still not clear how far one can go with the sparsity constraint
(which, should be recalled, was introduced to reduce the influence of
interactions between solutions without fully eliminating it). Current
condition $\log n \ll d \ll n^{2/7}$ might be extended, if one uses more
advanced bounding techniques.

Finally, but no less importantly, the free energy behavior of Gibbs-regularized
combinatorial optimization problems like sMBP looks very similar to that of REM
(Chapter~\ref{ch:smbp_and_rem}). Is this coincidental or does this tell us
anything about other aspects of their analogy? In particular, we see that they
are obviously different from the algorithmic point of view: while REM represents
total ``chaos'' with independent costs, the sMBP by definition has a certain
amount of cost dependence and thus intuitively should allow a more efficient
optimum searching than REM. Is this so, and if yes~--- can this line of
reasoning be further developed?

To understand that, one needs to properly estimate higher moments of the
log-partition function, which is highly non-trivial, but for sure a noble goal.


\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{url}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{array}

\title{Summary of the Biome Generation in \\ Minecraft 1.7 - 1.12}

\author{Cubitect}

\begin{document}

	\maketitle

	\begin{abstract}
		This document is designed to provide an overview of how Minecraft biome generation works and how we may efficiently find seeds with desired properties.
	\end{abstract}

	\newpage

	\tableofcontents

	\newpage

	\section{Biome Generator Layers}

	Minecraft biome generation occurs in layers. Many of these layers are chained together inside the generator, such that the output from one becomes the input for the next. A flowchart of this can be found on the next page.

	Each layer applies certain modifications to a map of integers, which change their use throughout the generation process. Initially the map only contains values 0 or 1, representing ocean or land masses. Later in the generator they represent temperature categories, until they are finally replaced by the actual biome IDs.

	Some of the layers resize the output of the previous layer. These Zoom-layers therefore change how much area is represented by a map entry. I will refer to this as "scale". For instance, 1:256 should be read as: one map entry ends up as an area of 256x256 blocks in the world.

	\setcounter{subsection}{-1}
	\subsection{Seed Finding}

	When constructing a seed finder, it may be useful to stop the generation at an earlier layer. For example if we require a swamp to be located near a given position, then we might want to generate up to layer 19: Biome first, and then check on a 1:256 scale if there is a swamp in the area. This is not enough to confirm that there will be a swamp at the given position, but we can rule out seeds that definitely don't have a swamp anywhere near the area. If the seed passes this cheap test, then we can go through the full expensive generation process and directly check the position for a swamp.

	Usually it is not practical to continue the search from a terminated generation and we have to start over again. The reason for this is that most layers require an additional 1 wide boarder from the previous layer, so the map sizes don't match up.

	Another more involved, but very powerful way of creating early knock-out criteria is to check if there is a some condition in the layer chain that is independent of the rest of the biomes. For instance in the case of finding a swamp, we can notice that there is a pseudo-random number check in layer 19: Biome, that converts Lush temperature climates to swamplands. However, the pseudo-random number generator is seeded by a combination of the position and the world seed, so we can make sure the random number output gives the required value without going through the rest of the layers. The more expensive generator can afterwards be used to make sure that a Lush climate is actually present at that position.

	In the summary below in sections 1.1 -- 1.44 I have laid out some of the properties of each layer, such as the scale of the layer and the possible values for the map entries with their respective average probability of occurrence (Note: these are estimates and may vary). When constructing a seed finder these values can be used as a reference to determine reasonable cut-off points for the generator.

	\includepdf[pages={1}]{layers.pdf}

	\subsection{Layer 1: Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:4096} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 90.0\%\\\hline
		1      & Land   & 10.0\%\\\hline
	\end{tabular}

	\subsection{Layer 2: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:2048} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 90.0\%\\\hline
		1      & Land   & 10.0\%\\\hline
	\end{tabular}

	\subsection{Layer 3: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:2048} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 84.3\%\\\hline
		1      & Land   & 15.7\%\\\hline
	\end{tabular}

	\subsection{Layer 4: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 84.9\%\\\hline
		1      & Land   & 15.1\%\\\hline
	\end{tabular}

	\subsection{Layer 5: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 81.4\%\\\hline
		1      & Land   & 18.6\%\\\hline
	\end{tabular}

	\subsection{Layer 6: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 77.5\%\\\hline
		1      & Land   & 22.5\%\\\hline
	\end{tabular}

	\subsection{Layer 7: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 73.4\%\\\hline
		1      & Land   & 26.6\%\\\hline
	\end{tabular}

	\subsection{Layer 8: Remove Too Much Ocean}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean  & 49.4\%\\\hline
		1      & Land   & 50.6\%\\\hline
	\end{tabular}

	\subsection{Layer 9: Add Snow}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type     & Occurrence \\\hline
		0      & Ocean    & 49.4\%\\\hline
		1      & Warm     & 33.7\%\\\hline
		3      & Cold     & 4.8\%\\\hline
		4      & Freezing & 12.4\%\\\hline
	\end{tabular}

	\medskip\noindent
	Changes some of the land starting points to Cold and Freezing.

	\subsection{Layer 10: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type    & Occurrence \\\hline
		0      & Ocean   & 33.8\%\\\hline
		1      & Warm    & 37.6\%\\\hline
		3      & Cold    & 4.8\%\\\hline
		4      & Freeing & 23.9\%\\\hline
	\end{tabular}

	\medskip\noindent
	Spreads out the continental areas, decreasing the amount of ocean.

	\subsection{Layer 11: Edge, Cool/Warm}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type     & Occurrence \\\hline
		0      & Ocean    & 33.8\%\\\hline
		1      & Warm     & 13.6\%\\\hline
		2      & Lush     & 23.9\%\\\hline
		3      & Cold     & 4.8\%\\\hline
		4      & Freezing & 23.9\%\\\hline
	\end{tabular}

	\medskip\noindent
	Changes Warm(1) lands which are adjacent to Cold(3) or Freezing(4) temperatures to Lush(2).

	\subsection{Layer 12: Edge, Heat/Ice}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type     & Occurrence \\\hline
		0      & Ocean    & 33.8\%\\\hline
		1      & Warm     & 13.6\%\\\hline
		2      & Lush     & 23.9\%\\\hline
		3      & Cold     & 23.9\%\\\hline
		4      & Freezing & 4.8\%\\\hline
	\end{tabular}

	\medskip\noindent
	Changes Freezing(4) lands which are adjacent to Warm(1) or Lush(2) temperatures to Cold(3).

	\subsection{Layer 13: Edge, Special}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1024} \\\hline\hline
		Value  & Type     & Occurrence \\\hline
		0      & Ocean    & 33.8\%\\\hline
		1      & Warm     & 12.5\%\\\hline
		2      & Lush     & 22.1\%\\\hline
		3      & Cold     & 22.1\%\\\hline
		4      & Freezing & 4.4\%\\\hline
		-      & Special  & 5.1\% / 60\\\hline
	\end{tabular}

	\medskip\noindent
	Marks every 1 in 13 lands (non-ocean) as special, by adding a 4-bit number in 0x0F00 to the value.

	\subsection{Layer 14: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:512} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean    & 35.6\%\\\hline
		1      & Warm     & 12.2\%\\\hline
		2      & Lush     & 21.9\%\\\hline
		3      & Cold     & 21.9\%\\\hline
		4      & Freezing & 4.2\%\\\hline
		-      & Special  & 4.2\% / 60\\\hline
	\end{tabular}

	\subsection{Layer 15: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:256} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean    & 35.6\%\\\hline
		1      & Warm     & 11.9\%\\\hline
		2      & Lush     & 21.9\%\\\hline
		3      & Cold     & 21.9\%\\\hline
		4      & Freezing & 4.2\%\\\hline
		-      & Special  & 4.5\% / 60\\\hline
	\end{tabular}

	\subsection{Layer 16: Add Island}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:256} \\\hline\hline
		Value  & Type   & Occurrence \\\hline
		0      & Ocean    & 31.4\%\\\hline
		1      & Warm     & 12.7\%\\\hline
		2      & Lush     & 22.4\%\\\hline
		3      & Cold     & 22.8\%\\\hline
		4      & Freezing & 6.2\%\\\hline
		-      & Special  & 4.5\% / 60\\\hline
	\end{tabular}

	\subsection{Layer 17: Add Mushroom Island}
	\begin{tabular}{|l|l|l|l|}\hline
		Scale: & \multicolumn{3}{|l|}{1:256} \\\hline\hline
		Value  & Type     & \multicolumn{2}{l|}{Occurrence} \\\hline
		0      & Ocean    & \multicolumn{2}{l|}{31.4\%}\\\hline
		1      & Warm     & \multicolumn{2}{l|}{12.8\%}\\\hline
		2      & Lush     & \multicolumn{2}{l|}{22.5\%}\\\hline
		3      & Cold     & \multicolumn{2}{l|}{22.7\%}\\\hline
		4      & Freezing & \multicolumn{2}{l|}{6.08\%}\\\hline
		14     & Mushroom & \multicolumn{2}{l|}{0.0773\%}\\\hline\hline

		\makecell[l]{ $(n<<8)+1$ \\ with $n = $ \\ $1, 4, 7, 10, 13$ } & - &
		\makecell[l]{0.0690\% \\each} & \multirow{5}{*}{0.90\%}\\\cline{1-3}

		\makecell[l]{ $(n<<8)+1$ \\ with $n = $ \\ $2, 3, 5, 6, 8, 9,$ \\ $11, 12, 14, 15$ } & - & \makecell[l]{0.0553\% \\ each} & \\\hline\hline

		\makecell[l]{ $(n<<8)+2$ \\ with $n = $ \\ $1, 4, 7, 10, 13$ } & - &
		\makecell[l]{0.1236\% \\ each} & \multirow{5}{*}{1.56\%}\\\cline{1-3}

		\makecell[l]{ $(n<<8)+2$ \\ with $n = $ \\ $2, 3, 5, 6, 8, 9,$ \\ $11, 12, 14, 15$ } & - & \makecell[l]{0.0961\% \\ each} & \\\hline\hline

		\makecell[l]{ $(n<<8)+3$ \\ with $n = $ \\ $1, 4, 7, 10, 13$ } & - &
		\makecell[l]{0.1078\% \\ each} & \multirow{5}{*}{1.58\%}\\\cline{1-3}

		\makecell[l]{ $(n<<8)+3$ \\ with $n = $ \\ $2, 3, 5, 6, 8, 9,$ \\ $11, 12, 14, 15$ } & - &
		\makecell[l]{0.1037\% \\ each} & \\\hline\hline

		\makecell[l]{ $(n<<8)+4$ \\ with $n = $ \\ $1, 4, 7, 10, 13$ } & - &
		\makecell[l]{0.0212\% \\ each} & \multirow{5}{*}{0.32\%}\\\cline{1-3}

		\makecell[l]{ $(n<<8)+4$ \\ with $n = $ \\ $2, 3, 5, 6, 8, 9,$ \\ $11, 12, 14, 15$ } & - &
		\makecell[l]{0.0212\% \\ each} & \\\hline

	\end{tabular}

	\medskip\noindent
	Changes every 100th Ocean (adjacent to more Ocean) to Mushroom Island. The special land types are written out in full in the table above. (Note "$<<$" represents a left bit shit.) Added together, the special types make up an average of about 4.37\% of the area.

	\subsection{Layer 18: Deep Ocean}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:256} \\\hline\hline
		Value  & Type       & Occurrence \\\hline
		0      & Ocean      & 22.0\%\\\hline
		1      & Warm       & 12.8\%\\\hline
		2      & Lush       & 22.5\%\\\hline
		3      & Cold       & 22.7\%\\\hline
		4      & Freezing   & 6.1\%\\\hline
		14     & Mushroom   & 0.0773\%\\\hline
		24     & Deep Ocean & 9.4\%\\\hline
		-      & Special    & 4.4\% / 60\\\hline
	\end{tabular}

	\medskip\noindent
	Changes any Ocean which is surrounded by more Ocean to Deep Ocean.\\
	(Special lands still have the same statistics as shown for Layer 17.)

	\subsection{Layer 19: Biome}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:256} \\\hline\hline
		Value  & Type           & Occurrence \\\hline
		0      & ocean          & 22.0\%\\\hline
		1      & plains         & 11.6\%\\\hline
		2      & desert         & 6.41\%\\\hline
		3      & extremeHills   & 9.44\%\\\hline
		4      & forest         & 9.43\%\\\hline
		5      & taiga          & 5.68\%\\\hline
		6      & swampland      & 3.75\%\\\hline
		12     & icePlains      & 4.80\%\\\hline
		14     & mushroomIsland & 0.0773\%\\\hline
		21     & jungle         & 1.58\%\\\hline
		24     & deepOcean      & 9.38\%\\\hline
		27     & birchForest    & 3.75\%\\\hline
		29     & roofedForest   & 3.75\%\\\hline
		30     & coldTaiga      & 1.60\%\\\hline
		32     & megaTaiga      & 1.58\%\\\hline
		35     & savanna        & 4.28\%\\\hline
		38     & mesaPlateau\_F & 0.598\%\\\hline
		39     & mesaPlateau    & 0.299\%\\\hline
	\end{tabular}

	\medskip\noindent
	Assigns the actual biome IDs to the lands, based on the temperature category of the land. To be more specific the selection criteria are:

	\begin{tabular}{l c c l}

	Temperature & & Weight & Biome \\\hline\hline

	Warm & $\longrightarrow$ &
	\makecell[c]{1/2 \\ 1/3 \\ 1/6} &
	\makecell[l]{desert \\ savanna \\ plains} \\\hline

	Warm, special & $\longrightarrow$ &
	\makecell[c]{1/3 \\ 2/3} &
	\makecell[l]{mesaPlateau \\ mesaPlateau\_F} \\\hline

	Lush & $\longrightarrow$ &
	\makecell[c]{1/6 \\ 1/6 \\ 1/6 \\ 1/6 \\ 1/6 \\ 1/6} &
	\makecell[l]{forest \\ roofedForest \\ extremeHills \\ plains \\ birchForest \\ swampland} \\\hline

	Lush, special & $\longrightarrow$ &
	\makecell[c]{1/1} &
	jungle \\\hline

	Cold & $\longrightarrow$ &
	\makecell[c]{1/4 \\ 1/4 \\ 1/4 \\ 1/4} &
	\makecell[l]{forest \\ extremeHills \\ taiga \\ plains} \\\hline

	Cold, special & $\longrightarrow$ &
	\makecell[c]{1/1} &
	megaTaiga \\\hline

	Freezing& $\longrightarrow$ &
	\makecell[c]{3/4 \\ 1/4} &
	\makecell[l]{icePlains \\ coldTaiga}

	\end{tabular}

	\medskip\noindent
	Ocean and Mushroom types are not affected by this layer. The special category is selected when one of the higher bits (0xF00) are set. E.g. 0x603 has high bits and is thus a special Cold(3) category.

	\subsection{Layer 20: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:128} \\\hline\hline
		Value  & Type           & Occurrence \\\hline
		0      & ocean          & 23.6\%\\\hline
		1      & plains         & 11.3\%\\\hline
		2      & desert         & 6.48\%\\\hline
		3      & extremeHills   & 9.28\%\\\hline
		4      & forest         & 9.28\%\\\hline
		5      & taiga          & 5.52\%\\\hline
		6      & swampland      & 3.61\%\\\hline
		12     & icePlains      & 4.94\%\\\hline
		14     & mushroomIsland & 0.0586\%\\\hline
		21     & jungle         & 1.62\%\\\hline
		24     & deepOcean      & 9.09\%\\\hline
		27     & birchForest    & 3.61\%\\\hline
		29     & roofedForest   & 3.61\%\\\hline
		30     & coldTaiga      & 1.45\%\\\hline
		32     & megaTaiga      & 1.62\%\\\hline
		35     & savanna        & 4.12\%\\\hline
		38     & mesaPlateau\_F & 0.602\%\\\hline
		39     & mesaPlateau    & 0.279\%\\\hline
	\end{tabular}

	\subsection{Layer 21: Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:64} \\\hline\hline
		Value  & Type           & Occurrence \\\hline
		0      & ocean          & 23.9\%\\\hline
		1      & plains         & 11.2\%\\\hline
		2      & desert         & 6.50\%\\\hline
		3      & extremeHills   & 9.23\%\\\hline
		4      & forest         & 9.23\%\\\hline
		5      & taiga          & 5.49\%\\\hline
		6      & swampland      & 3.56\%\\\hline
		12     & icePlains      & 5.00\%\\\hline
		14     & mushroomIsland & 0.0543\%\\\hline
		21     & jungle         & 1.62\%\\\hline
		24     & deepOcean      & 9.03\%\\\hline
		27     & birchForest    & 3.58\%\\\hline
		29     & roofedForest   & 3.57\%\\\hline
		30     & coldTaiga      & 1.43\%\\\hline
		32     & megaTaiga      & 1.62\%\\\hline
		35     & savanna        & 4.08\%\\\hline
		38     & mesaPlateau\_F & 0.603\%\\\hline
		39     & mesaPlateau    & 0.275\%\\\hline
	\end{tabular}
	\subsection{Layer 22: Biome Edge}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:64} \\\hline\hline
		Value  & Type             & Occurrence \\\hline
		0      & ocean            & 23.9\%\\\hline
		1      & plains           & 11.2\%\\\hline
		2      & desert           & 6.48\%\\\hline
		3      & extremeHills     & 9.23\%\\\hline
		4      & forest           & 9.23\%\\\hline
		5      & taiga            & 6.01\%\\\hline
		6      & swampland        & 3.47\%\\\hline
		12     & icePlains        & 5.00\%\\\hline
		14     & mushroomIsland   & 0.0543\%\\\hline
		21     & jungle           & 1.62\%\\\hline
		23     & jungleEdge       & 0.0144\%\\\hline
		24     & deepOcean        & 9.03\%\\\hline
		27     & birchForest      & 3.58\%\\\hline
		29     & roofedForest     & 3.57\%\\\hline
		30     & coldTaiga        & 1.43\%\\\hline
		32     & megaTaiga        & 1.11\%\\\hline
		34     & extremeHillsPlus & 0.0111\%\\\hline
		35     & savanna          & 4.09\%\\\hline
		37     & mesa             & 0.321\%\\\hline
 		38     & mesaPlateau\_F   & 0.385\%\\\hline
		39     & mesaPlateau      & 0.172\%\\\hline
	\end{tabular}

	\medskip\noindent
	Introduces the biomes jungleEdge, extremeHillsPlus and mesa. The conditional biome changes that take place in this layer are:

	\begin{tabular}{l c l}
		mesaPlateau\_F & $\longrightarrow$ & mesa\\
		mesaPlateau & $\longrightarrow$ & mesa\\
		megaTaiga & $\longrightarrow$ & taiga\\
		desert & $\longrightarrow$ & extremeHillsPlus\\
		swampland & $\longrightarrow$ & jungleEdge \\
		swampland & $\longrightarrow$ & plains
	\end{tabular}

	\subsection{Layer 23: River Init}

	Starts a new branch of off Layer 18: Deep Ocean. This layer overwrites each map entry that is not Ocean(0) with a pseudo random number between 2 and 300000 (inclusive).

	\subsection{Layer 24: Zoom}
	\subsection{Layer 25: Zoom}

	\subsection{Layer 26: Hills}
	This is a multilayer which joins the biome generation with the river generator branch at the layers Biome Edge (22) and Zoom (25). However at this stage the river branch is mostly just used as a pseudo random number source.

	\medskip\noindent
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:64} \\\hline\hline
		Value  & Type             & Occurrence \\\hline
		0      & ocean            & 17.5\%\\\hline
		1      & plains           & 9.86\%\\\hline
		2      & desert           & 4.83\%\\\hline
		3      & extremeHills     & 6.95\%\\\hline
		4      & forest           & 8.87\%\\\hline
		5      & taiga            & 4.67\%\\\hline
		6      & swampland        & 3.36\%\\\hline
		12     & icePlains        & 3.54\%\\\hline
		13     & iceMountains     & 1.30\%\\\hline
		14     & mushroomIsland   & 0.0543\%\\\hline
		17     & desertHills      & 1.46\%\\\hline
		18     & forestHills      & 2.68\%\\\hline
		19     & taigaHills       & 1.15\%\\\hline
		21     & jungle           & 1.15\%\\\hline
		22     & jungleHills      & 0.420\%\\\hline
		23     & jungleEdge       & 0.0140\%\\\hline
		24     & deepOcean        & 14.4\%\\\hline
		27     & birchForest      & 2.58\%\\\hline
		28     & birchForestHills & 0.800\%\\\hline
		29     & roofedForest     & 2.57\%\\\hline
		30     & coldTaiga        & 1.11\%\\\hline
		31     & coldTaigaHills   & 0.282\%\\\hline
		32     & megaTaiga        & 0.688\%\\\hline
		33     & megaTaigaHills   & 0.344\%\\\hline
		34     & extremeHillsPlus & 1.80\%\\\hline
		35     & savanna          & 3.05\%\\\hline
		36     & savannaPlateau   & 0.830\%\\\hline
		37     & mesa             & 0.486\%\\\hline
		38     & mesaPlateau\_F   & 0.240\%\\\hline
		39     & mesaPlateau      & 0.107\%\\\hline
	\end{tabular}
	\newpage\noindent
	\begin{tabular}{|l|l|l|}\hline
		129    & Sunflower Plains     & 0.4816\%\\\hline
		130    & Desert M             & 0.1971\%\\\hline
		131    & Extreme Hills M      & 0.2944\%\\\hline
		132    & Flower Forest        & 0.4904\%\\\hline
		133    & Taiga M              & 0.1897\%\\\hline
		134    & Swampland M          & 0.1109\%\\\hline
		140    & Ice Plains Spikes    & 0.1606\%\\\hline
		149    & Jungle M             & 0.0511\%\\\hline
		151    & Jungle Edge M        & 0.0005\%\\\hline
		155    & Birch Forest M       & 0.1154\%\\\hline
		156    & Birch Forest Hills M & 0.0854\%\\\hline
		157    & Roofed Forest M      & 0.1144\%\\\hline
		158    & Cold Taiga M         & 0.0461\%\\\hline
		160    & Mega Spruce Taiga    & 0.0365\%\\\hline
		161    & Redwood Taiga Hills  & 0.0366\%\\\hline
		162    & Extreme Hills+ M     & 0.1913\%\\\hline
		163    & Savanna M            & 0.1240\%\\\hline
		164    & Savanna Plateau M    & 0.0853\%\\\hline
		165    & Mesa (Bryce)         & 0.0263\%\\\hline
		166    & Mesa Plateau F M     & 0.0123\%\\\hline
		167    & Mesa Plateau M       & 0.0056\%\\\hline
	\end{tabular}

	\medskip\noindent
	Nine new biomes: iceMountains, desertHills, forestHills, taigaHills, jungleHills, birchForestHills, coldTaigaHills, megaTaigaHills and savannaPlateau. Also there are 21 new mutated variants which I have listed by their ingame display name.

	This layer converts some map entries to related biomes, forming small biome patches. A list of the conversions that take place in this manor is shown below. Additionally, this layer adds 128 to some map entries, provided that the resulting biome ID is valid, forming mutated biome variants.

	\begin{tabular}{l c l}
		desert & $\longrightarrow$ & desertHill\\
		forest & $\longrightarrow$ & forestHills\\
		birchForest & $\longrightarrow$ & birchForestHills\\
		roofedForest & $\longrightarrow$ & plains\\
		taiga & $\longrightarrow$ & taigaHills\\
		megaTaiga & $\longrightarrow$ & megaTaigaHills\\
		coldTaiga & $\longrightarrow$ & coldTaigaHills\\
		plains & $\longrightarrow$ & (1/3) forestHills, (2/3) forest\\
		icePlains & $\longrightarrow$ & iceMountains\\
		jungle & $\longrightarrow$ & jungleHills\\
		ocean & $\longrightarrow$ & deepOcean\\
		extremeHills & $\longrightarrow$ & extremeHillsPlus\\
		savanna & $\longrightarrow$ & savannaPlateau\\
		mesaPlateau\_F & $\longrightarrow$ & mesa\\
		deepOcean & $\longrightarrow$ & (1/2) plains, (1/2) forest
	\end{tabular}

	\subsection{Layer 27: Rare Biome}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:64} \\\hline\hline
		Value  & Type             & Occurrence \\\hline
		1      & plains           & 9.68\%\\\hline
		129    & Sunflower Plains & 0.654\%\\\hline
		...    & ...              & ...\\\hline
	\end{tabular}

	\medskip\noindent
	This layer converts 1/57 th of Plains to Sunflower Plains. It has no affect on other biomes.

	\subsection{Layer 31: Shore}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:16} \\\hline\hline
		Value  & Type                & Occurrence \\\hline
		0      & ocean               & 15.7\%\\\hline
		1      & plains              & 8.93\%\\\hline
		2      & desert              & 4.59\%\\\hline
		3      & extremeHills        & 6.68\%\\\hline
		4      & forest              & 8.67\%\\\hline
		5      & taiga               & 4.39\%\\\hline
		6      & swampland           & 3.44\%\\\hline
		12     & icePlains           & 3.44\%\\\hline
		13     & iceMountains        & 1.15\%\\\hline
		14     & mushroomIsland      & 0.0370\%\\\hline
		15     & mushroomIslandShore & 0.0208\%\\\hline
		16     & beach               & 3.81\%\\\hline
		17     & desertHills         & 1.27\%\\\hline
		18     & forestHills         & 2.27\%\\\hline
		19     & taigaHills          & 0.975\%\\\hline
		21     & jungle              & 1.03\%\\\hline
		22     & jungleHills         & 0.359\%\\\hline
		23     & jungleEdge          & 0.0853\%\\\hline
		24     & deepOcean           & 15.7\%\\\hline
		25     & stoneBeach          & 0.534\%\\\hline
		26     & coldBeach           & 0.311\%\\\hline
		27     & birchForest         & 2.45\%\\\hline
		28     & birchForestHills    & 0.800\%\\\hline
		29     & roofedForest        & 2.57\%\\\hline
		30     & coldTaiga           & 1.07\%\\\hline
		31     & coldTaigaHills      & 0.246\%\\\hline
		32     & megaTaiga           & 0.691\%\\\hline
		33     & megaTaigaHills      & 0.313\%\\\hline
		34     & extremeHillsPlus    & 2.84\%\\\hline
		35     & savanna             & 3.05\%\\\hline
		36     & savannaPlateau      & 0.715\%\\\hline
		37     & mesa                & 0.469\%\\\hline
		38     & mesaPlateau\_F      & 0.242\%\\\hline
		39     & mesaPlateau         & 0.103\%\\\hline
	\end{tabular}
	\newpage\noindent
	\begin{tabular}{|l|l|l|}\hline
		129    & Sunflower Plains     & 0.571\%\\\hline
		130    & Desert M             & 0.188\%\\\hline
		131    & Extreme Hills M      & 0.284\%\\\hline
		132    & Flower Forest        & 0.430\%\\\hline
		133    & Taiga M              & 0.176\%\\\hline
		134    & Swampland M          & 0.111\%\\\hline
		140    & Ice Plains Spikes    & 0.157\%\\\hline
		149    & Jungle M             & 0.0492\%\\\hline
		151    & Jungle Edge M        & 0.000451\%\\\hline
		155    & Birch Forest M       & 0.109\%\\\hline
		156    & Birch Forest Hills M & 0.0827\%\\\hline
		157    & Roofed Forest M      & 0.114\%\\\hline
		158    & Cold Taiga M         & 0.0477\%\\\hline
		160    & Mega Spruce Taiga    & 0.0358\%\\\hline
		161    & Redwood Taiga Hills  & 0.0354\%\\\hline
		162    & Extreme Hills+ M     & 0.184\%\\\hline
		163    & Savanna M            & 0.119\%\\\hline
		164    & Savanna Plateau M    & 0.0824\%\\\hline
		165    & Mesa (Bryce)         & 0.0236\%\\\hline
		166    & Mesa Plateau F M     & 0.0121\%\\\hline
		167    & Mesa Plateau M       & 0.00566\%\\\hline
	\end{tabular}

	\medskip\noindent
	New biomes: mushroomIslandShore, beach, stoneBeach, coldBeach.

	\subsection{Layer 41: River}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:4} \\\hline\hline
		Value  & Type             & Occurrence \\\hline
		-1     & none             & 94.3\%\\\hline
		7      & river            & 5.70\%\\\hline
	\end{tabular}

	\medskip\noindent
	Uses the zoomed pseudo random output of the river branch to determine the position of rivers in the world. All other values are set to -1.

	\subsection{Layer 43: River Mix}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:4} \\\hline\hline
		Value  & Type                & Occurrence \\\hline
		0      & ocean               & 13.9\%\\\hline
		1      & plains              & 9.69\%\\\hline
		2      & desert              & 4.80\%\\\hline
		3      & extremeHills        & 7.24\%\\\hline
		4      & forest              & 9.21\%\\\hline
		5      & taiga               & 4.47\%\\\hline
		6      & swampland           & 4.03\%\\\hline
		7      & river               & 4.19\%\\\hline
		11     & frozenRiver         & 0.0872\%\\\hline
		12     & icePlains           & 1.52\%\\\hline
		13     & iceMountains        & 0.495\%\\\hline
		14     & mushroomIsland      & 0.0257\%\\\hline
		15     & mushroomIslandShore & 0.0172\%\\\hline
		16     & beach               & 2.96\%\\\hline
		17     & desertHills         & 1.33\%\\\hline
		18     & forestHills         & 2.50\%\\\hline
		19     & taigaHills          & 0.994\%\\\hline
		21     & jungle              & 1.21\%\\\hline
		22     & jungleHills         & 0.421\%\\\hline
		23     & jungleEdge          & 0.101\%\\\hline
		24     & deepOcean           & 12.7\%\\\hline
		25     & stoneBeach          & 0.426\%\\\hline
		26     & coldBeach           & 0.132\%\\\hline
		27     & birchForest         & 2.96\%\\\hline
		28     & birchForestHills    & 0.849\%\\\hline
		29     & roofedForest        & 2.93\%\\\hline
		30     & coldTaiga           & 0.466\%\\\hline
		31     & coldTaigaHills      & 0.107\%\\\hline
		32     & megaTaiga           & 0.704\%\\\hline
		33     & megaTaigaHills      & 0.316\%\\\hline
		34     & extremeHillsPlus    & 1.69\%\\\hline
		35     & savanna             & 2.97\%\\\hline
		36     & savannaPlateau      & 0.750\%\\\hline
		37     & mesa                & 0.456\%\\\hline
		38     & mesaPlateau\_F      & 0.251\%\\\hline
		39     & mesaPlateau         & 0.110\%\\\hline
	\end{tabular}
	\newpage\noindent
	\begin{tabular}{|l|l|l|}\hline
		129    & Sunflower Plains     & 0.616\%\\\hline
		130    & Desert M             & 0.205\%\\\hline
		131    & Extreme Hills M      & 0.315\%\\\hline
		132    & Flower Forest        & 0.477\%\\\hline
		133    & Taiga M              & 0.184\%\\\hline
		134    & Swampland M          & 0.130\%\\\hline
		140    & Ice Plains Spikes    & 0.0681\%\\\hline
		149    & Jungle M             & 0.0582\%\\\hline
		151    & Jungle Edge M        & 0.000625\%\\\hline
		155    & Birch Forest M       & 0.136\%\\\hline
		156    & Birch Forest Hills M & 0.101\%\\\hline
		157    & Roofed Forest M      & 0.136\%\\\hline
		158    & Cold Taiga M         & 0.0196\%\\\hline
		160    & Mega Spruce Taiga    & 0.0371\%\\\hline
		161    & Redwood Taiga Hills  & 0.0369\%\\\hline
		162    & Extreme Hills+ M     & 0.203\%\\\hline
		163    & Savanna M            & 0.128\%\\\hline
		164    & Savanna Plateau M    & 0.0882\%\\\hline
		165    & Mesa (Bryce)         & 0.0257\%\\\hline
		166    & Mesa Plateau F M     & 0.0134\%\\\hline
		167    & Mesa Plateau M       & 0.00585\%\\\hline
	\end{tabular}

	\medskip\noindent
	This layer is actually used in parts of the Minecraft code where a faster alternative for the full biome generator is required. Note that this layer has a scale of 1:4 and the final map is just a zoomed version of this layer's output. The function of this layer is to apply the rivers to the main biome branch. A new biome is also added in this layer: frozenRiver.

	\subsection{Layer 44: Voronoi Zoom}
	\begin{tabular}{|l|l|l|}\hline
		Scale: & \multicolumn{2}{|l|}{1:1} \\\hline\hline
		Value  & Type                & Occurrence \\\hline
		0      & ocean               & 13.7\%\\\hline
		1      & plains              & 10.0\%\\\hline
		2      & desert              & 4.84\%\\\hline
		3      & extremeHills        & 7.50\%\\\hline
		4      & forest              & 9.54\%\\\hline
		5      & taiga               & 4.59\%\\\hline
		6      & swampland           & 4.22\%\\\hline
		7      & river               & 4.30\%\\\hline
		11     & frozenRiver         & 0.0806\%\\\hline
		12     & icePlains           & 1.40\%\\\hline
		13     & iceMountains        & 0.451\%\\\hline
		14     & mushroomIsland      & 0.0209\%\\\hline
		15     & mushroomIslandShore & 0.0137\%\\\hline
		16     & beach               & 2.92\%\\\hline
		17     & desertHills         & 1.33\%\\\hline
		18     & forestHills         & 2.59\%\\\hline
		19     & taigaHills          & 1.00\%\\\hline
		21     & jungle              & 1.26\%\\\hline
		22     & jungleHills         & 0.429\%\\\hline
		23     & jungleEdge          & 0.118\%\\\hline
		24     & deepOcean           & 11.2\%\\\hline
		25     & stoneBeach          & 0.433\%\\\hline
		26     & coldBeach           & 0.118\%\\\hline
		27     & birchForest         & 3.12\%\\\hline
		28     & birchForestHills    & 0.890\%\\\hline
		29     & roofedForest        & 3.09\%\\\hline
		30     & coldTaiga           & 0.428\%\\\hline
		31     & coldTaigaHills      & 0.0984\%\\\hline
		32     & megaTaiga           & 0.675\%\\\hline
		33     & megaTaigaHills      & 0.303\%\\\hline
		34     & extremeHillsPlus    & 1.74\%\\\hline
		35     & savanna             & 3.00\%\\\hline
		36     & savannaPlateau      & 0.751\%\\\hline
		37     & mesa                & 0.464\%\\\hline
		38     & mesaPlateau\_F      & 0.238\%\\\hline
		39     & mesaPlateau         & 0.105\%\\\hline
	\end{tabular}
	\newpage\noindent
	\begin{tabular}{|l|l|l|}\hline
		129    & Sunflower Plains     & 0.635\%\\\hline
		130    & Desert M             & 0.203\%\\\hline
		131    & Extreme Hills M      & 0.325\%\\\hline
		132    & Flower Forest        & 0.491\%\\\hline
		133    & Taiga M              & 0.190\%\\\hline
		134    & Swampland M          & 0.134\%\\\hline
		140    & Ice Plains Spikes    & 0.0625\%\\\hline
		149    & Jungle M             & 0.0612\%\\\hline
		151    & Jungle Edge M        & 0.000781\%\\\hline
		155    & Birch Forest M       & 0.144\%\\\hline
		156    & Birch Forest Hills M & 0.106\%\\\hline
		157    & Roofed Forest M      & 0.142\%\\\hline
		158    & Cold Taiga M         & 0.0181\%\\\hline
		160    & Mega Spruce Taiga    & 0.0356\%\\\hline
		161    & Redwood Taiga Hills  & 0.0354\%\\\hline
		162    & Extreme Hills+ M     & 0.210\%\\\hline
		163    & Savanna M            & 0.129\%\\\hline
		164    & Savanna Plateau M    & 0.0885\%\\\hline
		165    & Mesa (Bryce)         & 0.0258\%\\\hline
		166    & Mesa Plateau F M     & 0.0131\%\\\hline
		167    & Mesa Plateau M       & 0.00559\%\\\hline
	\end{tabular}

	\medskip\noindent
	This is the final layer in the biome generator and contains all the Overworld biomes except for frozenOcean, which does not generate in Mincraft 1.7 - 1.12.

\end{document}


\documentclass[main.tex]{subfiles}
\begin{document}

\subsection{Cold Dark Matter relics}

\marginpar{Wednesday\\ 2020-12-9, \\ compiled \\ \today}

CDM particles, definitionally, decouple when they are \emph{not} relativistic, so \(z_f = m_\psi / T > 1\) at freezeout; recall that freezeout is defined as the moment when the inequality \(\Gamma _A / A \lesssim 1\) starts to be satisfied, where \(\Gamma _A\) refers to the annihilation process \(\psi \overline{\psi} \leftrightarrow X \overline{X}\).

If we define \(y = n_\psi / s\), we can draw the usual decay curve \(y = y(z)\), which is constant and then has a decay (something like an inverted sigmoid); at decoupling the amount stops changing, and its value depends on \(z\) at that time.
The Boltzmann equation reads
%
\begin{align}
\dv{y}{z} = \frac{- zs \expval{\sigma _A \abs{v}}}{H (z=1)} \qty(y^2 - y^2 _{\text{eq}})
\,.
\end{align}

Typically we can model the term \(\expval{\sigma_A \abs{v}}\) as a powerlaw:
%
\begin{align}
\expval{\sigma_A \abs{v}} &\sim T^{n} \\
\expval{\sigma_A \abs{v}} &= \sigma_0 \qty( \frac{T}{m})^{n} = \sigma_0 \overline{z}^{-n}
\,,
\end{align}
%
therefore the differential equation for the abundance \(y\) reads
%
\begin{align}
\dv{y}{z} &= - \frac{\lambda}{z^{2 + n}} \qty(y^2 - y^2 _{\text{eq}}) \\
\lambda &= \frac{z^3 s \sigma_0 }{H(z=1)}
\,,
\end{align}
%
but recall that
%
\begin{align}
z^3 &= \qty( \frac{m}{T})^3  \\
s &= \frac{2 \pi^2}{45} g_* T^3  \\
H(z=1) &=  \qty(\frac{8 \pi G}{3})^{1/2} \qty(\frac{\pi^2}{30})^{1/2}
g_*^{1/2} \underbrace{\eval{T^2}_{z=1}}_{= m_\psi^2}
\marginnote{See \eqref{eq:decoupling-hubble-rate}.}
\,,
\end{align}
%
and with all these substitutions we can write
%
\begin{align}
\lambda \approx \num{.264} m_P m_\psi \sigma_0 \frac{g_{*s}}{g_*^{1/2}}
\,.
\end{align}

Further, we can model the equilibrium abundance as
%
\begin{align}
y _{\text{eq}} = \num{.145} \qty(\frac{g_*}{g_{*s}}) z^{3/2} e^{z}
\,,
\end{align}
%
with \(z > 1\).

Now, let us define \(\Delta = y - y _{\text{eq}} \); then, denoting derivatives with respect to \(z\) with primes we get
%
\begin{align}
\Delta' = - y' _{\text{eq}} - \frac{\lambda}{z^{2+n}} \qty(\Delta + 2 y _{\text{eq}}) \Delta
\,,
\end{align}
%
which can be solved by distinguishing two regimes: the first is for \textbf{early times}, defined by \(1 < z < z_f\), meaning that the particle is relativistic but still coupled.
This tells us that both \(\Delta \) and \(\Delta '\) are small; with this we can write
%
\begin{align}\label{eq:differential-equation-equilibrium-deviation-boltzmann}
\Delta &\approx \frac{z^{2+n}}{\lambda } \frac{- y' _{\text{eq}}}{\Delta + 2 y _{\text{eq}}}  \\
&\approx \frac{z^{2+n}}{\lambda } \frac{- y' _{\text{eq}}}{2 y _{\text{eq}}}  \\
&\approx \frac{z^{2+n}}{\lambda }
 \frac{y _{\text{eq}}}{2 y _{\text{eq}}} = \frac{z^{2+n}}{2 \lambda }
\,,
\end{align}
%
since when we differentiate \(y _{\text{eq}}\) one term is negligible.
\todo[inline]{I think, to check.}

On the other hand, at \textbf{late times} \(z \gg z_f\) we get \(y(z) \gg y _{\text{eq}} (z)\),\footnote{This is true since \(y\) is the \emph{actual} amount of particles in a comoving volume, while \(y _{\text{eq}}\) is the amount which \emph{would} be reached if there were equilibrium, which cannot happen due to decoupling.} therefore \(\Delta \approx y\).
With this approximation, we get
%
\begin{align}
\Delta ' = - \frac{\lambda}{z^{2+n}} \Delta^2
\,,
\end{align}
%
and solving this we find
%
\begin{align}
- \frac{\Delta '}{\Delta^2} &\approx \frac{\lambda }{z^{2 + n}}  \\
\frac{1}{\Delta _\infty } - \frac{1}{\Delta _f} &\approx \eval{- \frac{\lambda}{n+1} z^{-n-1}}_{z = z_f}^{z = \infty } \\
\frac{1}{\Delta_{\infty }} - \frac{1}{\Delta _f} &\approx  + \frac{\lambda }{z_f^{n+1} (n+1) }
\,,
\end{align}
%
but \(y_\infty < y_f\), meaning that we can neglect the \(y_f\) term and so
%
\begin{align}
y_\infty \approx \frac{z_f^{n+1}(n+1)}{\lambda } \approx
\frac{\num{3.79} (n+1) z_f^{n+1}}{(g_{*s} / g_*^{1/2}) m_P m_\psi \sigma_0 }
\,.
\end{align}

From this, using \(n_\psi = s_0 y_\infty \) and the expression \(s_0 \approx \SI{2e3}{cm^{-3}}\) (if one neutrino species is relativistic today), then we can calculate
%
\begin{align}
\Omega_{\psi_0 } h^2 = \frac{\num{.75e9}(n+1)z_f^{n+1}}{(g_{*s} / g_*^{1/2}) m_P  \sigma_0} \SI{}{GeV^{-1}}
\,.
\end{align}

Here we used \(\Omega _{\psi_0 } = m_\psi n_{\psi_0 }  / \rho _{\text{crit}}\), with \(\rho _{\text{crit}} \approx \SI{e4}{eV cm^{-3} h^2}\).
We appear to have eliminated the dependence on \(m_\psi \), but this is not completely the case: \(\sigma_0\), \(z_f\) and \(g_*\) still depend (at least weakly) on it.

The crucial result from this manipulation is
%
\begin{align}
\Omega_{\psi_0 } h^2 \propto \frac{1}{\sigma_0 }
\,.
\end{align}

This is somewhat intuitive: if the particle interacts more then its abundance has more time to decrease with the Boltzmann suppression.

Manipulating the expression with some typical values, we get
%
\begin{align}
\Omega_{\psi_0} h^2 \approx \order{1} (n+1) \qty(\frac{z_f}{10})^{n+1}
\qty(\frac{g_*}{100})^{1/2} \qty(\frac{100}{g_{*s}}) \frac{\SI{e-38}{cm^2}}{\sigma_0 }
\,.
\end{align}

The natural normalization arising for \(\sigma_0\) is \SI{e-2}{pbn} (picobarns), a very small cross-section, which is the typical order of magnitude of weak-interaction cross-sections.
This is what is called the \textbf{WIMP miracle}, where WIMP means Weakly-Interacting Massive Particle.

The freezout epoch is the one at which the abundance \(y\) departs from its equilibrium value: then, we ask that \(\Delta (z_f) = y(z_f) - y _{\text{eq}} (z_f) = c y _{\text{eq}}\), with \(c\) being a coefficient of order unity.

Plugging in the expression we derived earlier into \eqref{eq:differential-equation-equilibrium-deviation-boltzmann}, we get
%
\begin{align}
\Delta(z_f) = \lambda^{-1} \frac{z_f^{n+2} y_{\text{eq}}(z_f)}{2 y _{\text{eq}}(z_f) + \Delta (z_f)} = \frac{z_f^{n+2}}{\lambda } \frac{1}{2 + c}
\,,
\end{align}
%
therefore
%
\begin{align}
\frac{z_f^{n+2}}{\lambda } \frac{1}{2 + c}
&= c a z_f^{3/2} e^{-z_f}  \\
a &= \num{.145} \frac{g_\psi }{g_{*s}}
\,,
\end{align}
%
a transcendental equation which can be solved iteratively, yielding
%
\begin{align}
z_f^{(0)} &= \log \qty[c (c+2) a \lambda ]  \\
&=\log \qty[\num{.038} (n+1) m _{\text{Pl}} m_\psi \sigma_0 \frac{g_\psi }{g_{*s}}]
\,,
\end{align}
%
and a good approximation is found to be \(c ( c+ 2) = n+1\).
The second iteration then yields
%
\begin{align}
z_f^{(1)} = \log \qty[c (c+2) a \lambda ] - \qty( \frac{1}{2} + n) \log \qty[c (c+2) a \lambda ]
\,,
\end{align}
%
which means that \(z_f\) does indeed depend on the mass of the particle, although it is a weak dependence since it is in the logarithm.

As an example, if \(m_\psi \) were of the order of \SI{100}{GeV} and if we had \(\sigma_0 \sim \SI{e-38}{cm^{-2}}\), then we would get
%
\begin{align}
z_f \approx \begin{cases}
    17 & \text{for } n=0 \\
    14 & \text{for } n=1 \\
    12 & \text{for } n=2
\end{cases}
\,.
\end{align}

This means that \(T_f \approx m_\psi / 10\), therefore \(T_f \approx 10 \divisionsymbol \SI{100}{GeV}\) is the typical order of magnitude of the decoupling temperature.
The relics we discussed are \emph{thermal}, but \textbf{non-thermal} relics are also possible; their abundance is much more model-dependent.
For example, axions might be produced through a ``misalignment mechanism'', and other relics might be produced through a ``freeze-in mechanism''.

\todo[inline]{See picture from the slides: FIMP.}

\chapter{Cosmological perturbation within GR}

\section{The gauge issue}

We will treat the \textbf{gauge issue} for perturbations. Einstein's equations are invariant under diffeomorphisms, so we must be careful and use invariant quantities.
We already used
%
\begin{align}
\zeta  = - H \frac{ \delta \rho}{\dot{\rho} } - \hat{\Phi}
\,,
\end{align}
%
where \(\hat{\Phi}\) is a scalar perturbation of the spatial part of the metric tensor, which will be discussed later.

Then, we will try to get a proper treatment of cosmological perturbations within GR.
We have already seen how to treat them in a Newtonian way (i.e.\ Jeans instability).
This is not ok when the wavelength of the perturbation is larger than the Hubble radius.

The Poisson equation, in terms of \(\delta = \delta \rho / \rho \), reads
%
\begin{align}
\nabla^2 \varphi = 4 \pi G \delta \rho  = 4 \pi G \overline{\rho} \delta
\,,
\end{align}
%
so in terms of characteristic lengths we get
%
\begin{align}
\frac{\varphi}{\lambda^2 _{\text{phys}}} \sim \frac{3}{2} H^2 \delta
\marginnote{From the Friedmann equations.}
\,,
\end{align}
%
therefore, in terms of \(\lambda _H = 1 / H\):
%
\begin{align}
\varphi \sim \qty(\frac{\lambda _{\text{phys}}}{\lambda _H})^2 \delta
\,,
\end{align}
%
and reintroducing the speed of light
%
\begin{align}
\frac{\varphi}{c^2} \sim \qty(\frac{\lambda _{\text{phys}}}{\lambda _H})^2 \delta
\,.
\end{align}

When \(\varphi / c^2\) is of order 1 or larger we expect to see GR effects.

We know that typically \(\delta \sim \num{e-5}\) for primordial perturbations, so when \(\lambda _{\text{phys}} \ll \lambda _H\) the Newtonian treatment is fine; while when the perturbations are outside the horizon the perturbations are frozen.

We will adopt a perturbative approach, which in GR is a perturbation of the geometry itself (as well as the fields).
Consider a generic tensor field \(T\): a perturbation of this quantity is defined as
%
\begin{align}
\Delta T = T - T_0
\,,
\end{align}
%
where \(T\) is evaluated in the perturbed universe, while \(T_0 \) is evaluated in the unperturbed FLRW spacetime.
We are then comparing two tensors, but they will be defined at two different spacetime locations.
This is not allowed in differential geometry: in order to make the comparison meaningful we need a one-to-one correspondence between the perturbed and unperturbed spacetimes (denoted respectively as \(\mathcal{M}\) and \(\mathcal{M}_0\)); this amounts to making a specific gauge choice.

A gauge transformation is a change of the map \(\mathcal{M}_0 \to \mathcal{M}\) (which we denote as \(\psi \), such that for \(p \in \mathcal{M}_0\) and \(O\in \mathcal{M}\) we have \(p \to O = \psi (p)\)) which \emph{keeps the coordinates on \(\mathcal{M}_0\) fixed}; this is different from a coordinate transformation.

The gauge issue comes from the freedom of always making a gauge transformation: changing the map \(\psi \) to \(\psi' \colon p \to O' = \psi '(p)\).

A coordinate system is defined by a threading of spacetime into lines (corresponding to fixed spatial coordinates) and by a slicing of spacetime into hypersurfaces (corresponding to fixed time).

A gauge transformation can be defined in a completely coordinate-free way.

We can change our point of view: instead of changing the point in \(\mathcal{M}\) to which our point in \(\mathcal{M}_0\) maps, we can see the transformation as a change in the point in \(\mathcal{M}_0\) from which we start to reach the fixed point in \(\mathcal{M}\).
In terms of the points we defined before, this amounts to finding a \(q \in \mathcal{M}_0\) such that \(\psi' (q) = O\), and then seeing the gauge transformation as a map which takes \(p\) to \(q = \psi^{\prime, -1} (\psi (p))\).

If we have a quantity \(T\) which is a scalar under coordinate transformation, then it still \emph{can} change if we make a gauge transformation.

\end{document}