game-of-life-theme 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -68
- data/_includes/head.html +2 -1
- data/_layouts/home.html +20 -19
- data/assets/game_of_life.js +47 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce58a02b867a0979bfe0d5faaafa32948759e997
|
4
|
+
data.tar.gz: 581cb792a917cee3a2cb54bef6c32f59aa6382f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 710a9bc1f1b70b8e24053820029970b6a500c13a569b4937f2d2a1ee4396b4fa02b4f1c7b699c06b0b9f9ac0292b9c3d48b281c24ee845a0eb3819acb307d0f3
|
7
|
+
data.tar.gz: faea66c9f27a1e993a8499cabd69cdccbb8afd33b973acfc86ceeaa754d5da15280ee25bfaf4ca8a1ccdcfbb4d65576a382ebd5a1c5bab038a78e788f20796ba
|
data/README.md
CHANGED
@@ -1,67 +1,6 @@
|
|
1
|
-
# game-of-life
|
1
|
+
# Jekyll theme `game-of-life`
|
2
2
|
|
3
|
-
|
4
|
-
need to be able to package up your theme into a gem. Put your layouts in
|
5
|
-
`_layouts`, your includes in `_includes` and your sass in `_sass`.
|
6
|
-
|
7
|
-
To experiment with this code, add some sample content and run `bundle exec jekyll
|
8
|
-
serve` – this directory is setup just like a Jekyll site!
|
9
|
-
Also, you can adjust this command
|
10
|
-
`bundle exec jekyll --host <host-name> --port <port>` to suit your needs.
|
11
|
-
Site will be available at `<host-name>:<port>` in your browser.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Add this line to your Jekyll site's `Gemfile`:
|
16
|
-
|
17
|
-
```ruby gem "game-of-life" ```
|
18
|
-
|
19
|
-
And add this line to your Jekyll site's `_config.yml`:
|
20
|
-
|
21
|
-
```yaml theme: game-of-life ```
|
22
|
-
|
23
|
-
And then execute:
|
24
|
-
|
25
|
-
$ bundle
|
26
|
-
|
27
|
-
Or install it yourself as:
|
28
|
-
|
29
|
-
$ gem install game-of-life
|
30
|
-
|
31
|
-
## Contributing
|
32
|
-
|
33
|
-
Bug reports and pull requests are welcome on GitHub at
|
34
|
-
https://github.com/[USERNAME]/hello. This project is intended to be a safe,
|
35
|
-
welcoming space for collaboration, and contributors are expected to adhere to
|
36
|
-
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
37
|
-
|
38
|
-
## Development
|
39
|
-
|
40
|
-
To set up your environment to develop this theme, run `bundle install`.
|
41
|
-
|
42
|
-
Your theme is setup just like a normal Jekyll site! To test your theme, run
|
43
|
-
`bundle exec jekyll serve` and open your browser at `http://localhost:4000`.
|
44
|
-
This starts a Jekyll server using your theme. Add pages, documents, data, etc.
|
45
|
-
like normal to test your theme's contents. As you make modifications to your
|
46
|
-
theme and to your content, your site will regenerate and you should see the
|
47
|
-
changes in the browser after a refresh, just like normal.
|
48
|
-
|
49
|
-
When your theme is released, only the files in `_layouts`, `_includes`, and
|
50
|
-
`_sass` tracked with Git will be released.
|
51
|
-
|
52
|
-
## License
|
53
|
-
|
54
|
-
The theme is available as open source under the terms of the [MIT
|
55
|
-
License](https://opensource.org/licenses/MIT).
|
56
|
-
|
57
|
-
## Steps
|
58
|
-
|
59
|
-
- Ruby Gems account
|
60
|
-
- suppose that Ruby, Bundler and Jekyll are in place
|
61
|
-
- `jekyll new-theme <theme-name>`
|
62
|
-
- update `.gemspec` file
|
63
|
-
|
64
|
-
## Theme
|
3
|
+
Short description and a ToDos (update README)
|
65
4
|
|
66
5
|
### Usage
|
67
6
|
|
@@ -74,13 +13,18 @@ board.fill(starting_column, ending_column, starting_row, ending_row);
|
|
74
13
|
|
75
14
|
### Functionality
|
76
15
|
|
16
|
+
This theme is breaking the rule and visitor can interact with the Game after
|
17
|
+
it has started. However, nice people are still able to observe how initial
|
18
|
+
game evolves.
|
19
|
+
|
77
20
|
- if your eyes are a bit tired and you'd prefer to quietly read a page, type `q`
|
78
|
-
- type `i` to start the Insert Mode
|
21
|
+
- type `i` to start the Insert Mode where you can create new cells
|
79
22
|
- with a click of a mouse new cells will be randomily created around
|
80
|
-
- if you are feeling happy, drag mouse to create more
|
81
|
-
- press `ESC` to
|
82
|
-
- press
|
83
|
-
-
|
23
|
+
- if you are feeling happy, drag mouse to create some more
|
24
|
+
- press `ESC` to --- escape the Insert Mode
|
25
|
+
- press `e` to restart the Game
|
26
|
+
- use `j` and `k` to control the speed
|
27
|
+
- to change the cells' color press any additional key
|
84
28
|
|
85
29
|
ToDo:
|
86
30
|
|
data/_includes/head.html
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
<head>
|
2
2
|
<meta charset="utf-8">
|
3
|
+
<title>{{ page.title }} - {{ site.author }}</title>
|
3
4
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=0.8">
|
5
6
|
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
|
6
7
|
</head>
|
data/_layouts/home.html
CHANGED
@@ -4,29 +4,30 @@ layout: default
|
|
4
4
|
|
5
5
|
<div class="card yellow-background">
|
6
6
|
{% if page.title %}
|
7
|
-
|
7
|
+
<h1 class="page-heading">{{ page.title }}</h1>
|
8
8
|
{% endif %}
|
9
9
|
|
10
10
|
{{ content }}
|
11
11
|
|
12
12
|
{% if site.posts.size > 0 %}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
</
|
13
|
+
<h3>{{ page.list_title | default: "Posts:" }}</h2>
|
14
|
+
<ul>
|
15
|
+
{% for post in site.posts %}
|
16
|
+
<li>
|
17
|
+
<h3>
|
18
|
+
<a class="post-link" href="{{ post.url | relative_url }}">
|
19
|
+
{{ post.title | escape }}
|
20
|
+
</a>
|
21
|
+
</h3>
|
22
|
+
<p>
|
23
|
+
{% if site.show_excerpts %}
|
24
|
+
{{ post.excerpt }}
|
25
|
+
{% endif %}
|
26
|
+
</p>
|
27
|
+
{% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
|
28
|
+
<span class="post-meta">{{ post.date | date: date_format }}</span>
|
29
|
+
</li>
|
30
|
+
{% endfor %}
|
31
|
+
</ul>
|
30
32
|
{% endif %}
|
31
|
-
|
32
33
|
</div>
|
data/assets/game_of_life.js
CHANGED
@@ -1,29 +1,36 @@
|
|
1
|
-
var w;
|
2
|
-
var
|
3
|
-
var
|
4
|
-
var insert_mode;
|
1
|
+
var w, columns, rows;
|
2
|
+
var insert_mode, clear_mode, easter_egg;
|
3
|
+
var counter, frequence;
|
5
4
|
let board, next;
|
6
5
|
|
7
6
|
function setup() {
|
8
7
|
createCanvas(windowWidth, windowHeight);
|
9
|
-
w =
|
10
|
-
|
8
|
+
w = 8;
|
9
|
+
easter_egg = 0;
|
10
|
+
counter = 0; frequence = 50;
|
11
|
+
insert_mode = 0; clear_mode = 0;
|
11
12
|
columns = floor(width/w);
|
12
13
|
rows = floor(height/w);
|
13
14
|
|
14
15
|
randomize_colors();
|
15
16
|
board = new Board(columns, rows);
|
16
|
-
board.fill(0, columns, 0,
|
17
|
+
board.fill(0, columns, 0, 3);
|
17
18
|
next = new Board(columns, rows);
|
18
19
|
next.empty();
|
19
|
-
}
|
20
20
|
|
21
|
-
function draw() {
|
22
21
|
background(253, 253, 253);
|
23
|
-
generate();
|
24
22
|
draw_board();
|
25
23
|
}
|
26
24
|
|
25
|
+
function draw() {
|
26
|
+
if (counter % frequence === 0 && easter_egg === 1){
|
27
|
+
background(253, 253, 253);
|
28
|
+
draw_board();
|
29
|
+
generate();
|
30
|
+
}
|
31
|
+
counter += 1;
|
32
|
+
}
|
33
|
+
|
27
34
|
function draw_board(){
|
28
35
|
for ( var i = 0; i < columns;i++) {
|
29
36
|
for ( var j = 0; j < rows;j++) {
|
@@ -50,7 +57,7 @@ function mouseDragged() {
|
|
50
57
|
var tmpX = floor(mouseX/w);
|
51
58
|
var tmpY = floor( mouseY/w);
|
52
59
|
|
53
|
-
board.fill(tmpX -
|
60
|
+
board.fill(tmpX - 4, tmpX + 4, tmpY - 4, tmpY + 4);
|
54
61
|
}
|
55
62
|
return false;
|
56
63
|
}
|
@@ -66,27 +73,47 @@ function mousePressed() {
|
|
66
73
|
return false;
|
67
74
|
}
|
68
75
|
|
69
|
-
function
|
70
|
-
if (
|
71
|
-
|
76
|
+
function keyTyped(){
|
77
|
+
if (key ==='e') {
|
78
|
+
frequence = 50;
|
79
|
+
easter_egg = 1;
|
72
80
|
randomize_colors();
|
73
|
-
board.empty()
|
74
|
-
board.fill(0, columns,
|
81
|
+
board.empty();
|
82
|
+
board.fill(0, columns, rows - 30, rows);
|
83
|
+
}
|
84
|
+
else if (key === 'q') {
|
85
|
+
hide_game_of_life();
|
86
|
+
clear_mode = 1;
|
87
|
+
insert_mode = 0;
|
88
|
+
}
|
89
|
+
else if (key === 'k') {
|
90
|
+
insert_mode = 0;
|
91
|
+
frequence = max(5, frequence - 5);
|
92
|
+
}
|
93
|
+
else if (key === 'j') {
|
94
|
+
insert_mode = 0;
|
95
|
+
frequence += 5;
|
96
|
+
}
|
97
|
+
else if (key === 'i'){
|
98
|
+
if (clear_mode == 1) insert_mode = 0;
|
99
|
+
else {
|
100
|
+
clear_mode = 0;
|
101
|
+
insert_mode = 1;
|
102
|
+
};
|
75
103
|
} else randomize_colors();
|
76
|
-
}
|
77
104
|
|
78
|
-
|
79
|
-
if (key === 'i') insert_mode = 1;
|
80
|
-
else if (key === 'q') hide_game_of_life();
|
105
|
+
return false;
|
81
106
|
}
|
82
107
|
|
83
108
|
function randomize_colors(){
|
109
|
+
clear_mode = 0;
|
84
110
|
r = random(255);
|
85
111
|
g = random(255);
|
86
112
|
b = random(255);
|
87
113
|
}
|
88
114
|
|
89
115
|
function hide_game_of_life(){
|
116
|
+
clear_mode = 1;
|
90
117
|
r = 253;
|
91
118
|
g = 253;
|
92
119
|
b = 255;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: game-of-life-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Milana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|