Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusmerzin committed May 4, 2020
1 parent 869a66e commit add55cf
Show file tree
Hide file tree
Showing 14 changed files with 422 additions and 360 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ Trigonometric functions have tests created using [Jest](https://jestjs.io).
Ants is available at [rasmusmerzin.github.io/ants](https://rasmusmerzin.github.io/ants).

## Table of contents
* [Setup](#Setup)
* [Downloading and installing](#Downloading-and-installing)
* [Running the app](#Running-the-app)
* [Running tests](#Running-tests)
* [Production build](#Production-build)
* [GitHub pages](#GitHub-pages)
* [User interface](#User-interface)
* [Algorithm](#Algorithm)
* [Mathematics](#Mathematics)
* [One neighbour in range](#One-neighbour-in-range)
* [Multiple neighbours in range](#Multiple-neighbours-in-range)
* [No neighbours in range](#No-neighbours-in-range)
* [Summary](#Summary)

- [Setup](#Setup)
- [Downloading and installing](#Downloading-and-installing)
- [Running the app](#Running-the-app)
- [Running tests](#Running-tests)
- [Production build](#Production-build)
- [GitHub pages](#GitHub-pages)
- [User interface](#User-interface)
- [Algorithm](#Algorithm)
- [Mathematics](#Mathematics)
- [One neighbour in range](#One-neighbour-in-range)
- [Multiple neighbours in range](#Multiple-neighbours-in-range)
- [No neighbours in range](#No-neighbours-in-range)
- [Summary](#Summary)

## Setup

I used [Node.js](https://nodejs.org) 14.0.0 and [Yarn](https://classic.yarnpkg.com) 1.22.4 while developing this project.

> Note: I found out that with these versions of Node.js and Yarn and with node-sass versions 4.13.1 and 4.14.0 using CSS variables `var(--`*var*`)` in `calc()` functions compiles in development mode but throws an error during `react-scripts build`. In such cases I used Sass variables.
> Note: I found out that with these versions of Node.js and Yarn and with node-sass versions 4.13.1 and 4.14.0 using CSS variables `var(--`_var_`)` in `calc()` functions compiles in development mode but throws an error during `react-scripts build`. In such cases I used Sass variables.
Module versions and scripts are available in [package.json](https://github.com/rasmusmerzin/ants/blob/master/package.json).

Expand Down Expand Up @@ -83,7 +84,6 @@ For each [Ant](https://github.com/rasmusmerzin/ants/blob/master/src/logic/Ant.ts

A velocity for each ant is calculated every frame depending on the count of peers in range.


### One peer in range

When there is another ant in distancing range **`R`** the a distancing push **`p`** will be calculated.
Expand All @@ -101,7 +101,6 @@ When there is only one neighbour in range the velocity of the given ant is equal

<img src='./docs/formula_01.svg' alt='p=k*R/d' />


### Multiple peers in range

When there are multiple neighbours in range the velocity of the given ant is equal to vector sum of it's neighbours' push vectors.
Expand All @@ -122,7 +121,8 @@ When there are no peers in range ant's velocity will be turned at random to left
<img src='./docs/diagram_03.svg' alt='diagram 3' />

`l` ‒ previous frame's velocity
`α` ‒ amount to change velocity direction based on ants agility
`α` ‒ amount to change velocity direction based on ants agility

> `(Math.random() -.5) *2 *`_agility_
## Summary
Expand Down
5 changes: 4 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="theme-color" content="#1c1c1c" />
<meta
name="description"
Expand Down
5 changes: 3 additions & 2 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
height: 100%;
}

button, a {
button,
a {
cursor: pointer;
color: inherit;
font: inherit;
Expand All @@ -37,7 +38,7 @@
border: none;
}

input[type=range] {
input[type="range"] {
cursor: pointer;
}
}
Loading

0 comments on commit add55cf

Please sign in to comment.