chessboard 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +87 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/chessboard.gemspec +34 -0
- data/lib/chessboard/version.rb +3 -0
- data/lib/chessboard.rb +5 -0
- data/lib/generators/chessboard/USAGE +13 -0
- data/lib/generators/chessboard/chessboard_generator.rb +55 -0
- data/lib/generators/chessboard/templates/chess.min.js +6 -0
- data/lib/generators/chessboard/templates/chessboard-0.3.0.min.css +2 -0
- data/lib/generators/chessboard/templates/chessboard-0.3.0.min.js +31 -0
- data/lib/generators/chessboard/templates/chessboard_controller.rb +4 -0
- data/lib/generators/chessboard/templates/chessboard_empty_board.html.erb +5 -0
- data/lib/generators/chessboard/templates/chessboard_highlight_legal_moves.html.erb +83 -0
- data/lib/generators/chessboard/templates/chessboard_only_legal_moves.html.erb +84 -0
- data/lib/generators/chessboard/templates/chessboard_piece_highlighting_1.html.erb +68 -0
- data/lib/generators/chessboard/templates/chessboard_piece_highlighting_2.html.erb +97 -0
- data/lib/generators/chessboard/templates/chessboard_play_random_computer.html.erb +98 -0
- data/lib/generators/chessboard/templates/chessboard_random_vs_random.html.erb +25 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bB.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bK.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bN.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bP.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bQ.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/bR.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wB.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wK.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wN.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wP.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wQ.png +0 -0
- data/lib/generators/chessboard/templates/chesspieces/wikipedia/wR.png +0 -0
- metadata +144 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a537bf33cf726b4e8dec82bce2baff62e254d5e0
|
|
4
|
+
data.tar.gz: 406852402db92ae49be30c44a0fabaab25b28ef7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3788536feda016f7d1fab35977e5581618d8161c7c528f73dbfe7c13e8814db115c7158009612ba92a6877bba2e3c3a137d3263ead4f17ed3d4950a06bd80e37
|
|
7
|
+
data.tar.gz: 804b8b135bd60262ce53e4167721dadb4eb27898282375c2709a78e13b16c923726cca385192edbfb0a72f4269ed0c5e6311f03212de8ce0540dd12935aaaee6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at dhrubo_moy@yahoo.com. All
|
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
45
|
+
version 1.3.0, available at
|
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
47
|
+
|
|
48
|
+
[homepage]: http://contributor-covenant.org
|
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Dhrubomoy Das Gupta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Chessboard
|
|
2
|
+
|
|
3
|
+
A ruby gem to generate necessary assets (javascripts, stylesheets and images), controller and view in order to easily add varieties of chessboards in your Ruby on Rails 5 applications. Thanks to chess libraries like [chessboard.js](https://github.com/oakmac/chessboardjs/) and [chess.js] (https://github.com/jhlywa/chess.js) and awesome power of Ruby on Rails, you can add a nice chessboard in your rails 5 application with literally 3 commands.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'chessboard'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle install
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install chessboard
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Basic Usage
|
|
24
|
+
|
|
25
|
+
1. After installation run `rails generate chessboard` or `rails g chessboard`
|
|
26
|
+
2. Start the rails server `rails server` or `rails s`
|
|
27
|
+
3. Open your favourite browser and visit [http://localhost:3000/chessboard](http://localhost:3000/chessboard)
|
|
28
|
+
|
|
29
|
+
### Print help message
|
|
30
|
+
|
|
31
|
+
Run `rails g chessboard --help` to print following:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Usage:
|
|
35
|
+
rails generate chessboard [CHESSBOARD_NAME] [options]
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
[--skip-controller], [--no-skip-controller] # Skip including chessboard controller.
|
|
39
|
+
[--skip-route], [--no-skip-route] # Skip adding route for chessboard in your config/route.rb
|
|
40
|
+
[--skip-view], [--no-skip-view] # Skip including chessboard view (.html.erb file).
|
|
41
|
+
[--chessboard-type=CHESSBOARD_TYPE] # Specify what type of chessboard you want in your view.
|
|
42
|
+
Available options:
|
|
43
|
+
only_legal_moves,
|
|
44
|
+
play_random_computer,
|
|
45
|
+
empty_board,
|
|
46
|
+
random_vs_random,
|
|
47
|
+
highlight_legal_moves,
|
|
48
|
+
piece_highlighting_1,
|
|
49
|
+
piece_highlighting_2
|
|
50
|
+
# Default: only_legal_moves
|
|
51
|
+
|
|
52
|
+
Runtime options:
|
|
53
|
+
-f, [--force] # Overwrite files that already exist
|
|
54
|
+
-p, [--pretend], [--no-pretend] # Run but do not make any changes
|
|
55
|
+
-q, [--quiet], [--no-quiet] # Suppress status output
|
|
56
|
+
-s, [--skip], [--no-skip] # Skip files that already exist
|
|
57
|
+
|
|
58
|
+
Description:
|
|
59
|
+
Generates controller, view, javascripts and stylesheets for a chessboard.
|
|
60
|
+
|
|
61
|
+
Example:
|
|
62
|
+
rails generate chessboard
|
|
63
|
+
|
|
64
|
+
This will create:
|
|
65
|
+
vendor/assets/javascript/chess.min.js
|
|
66
|
+
vendor/assets/javascript/chessboard-0.3.0.min.js
|
|
67
|
+
vendor/assets/stylesheets/chessboard-0.3.0.min.css
|
|
68
|
+
app/controllers/chessboard_controller.rb
|
|
69
|
+
app/assets/images/chesspieces/<Images>.png
|
|
70
|
+
app/views/chessboard/chessboard.html.erb
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Development
|
|
74
|
+
|
|
75
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
76
|
+
|
|
77
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/chessboard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
87
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "chessboard"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/chessboard.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'chessboard/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "chessboard"
|
|
8
|
+
spec.version = Chessboard::VERSION
|
|
9
|
+
spec.authors = ["Dhrubomoy Das Gupta"]
|
|
10
|
+
spec.email = ["dhrubo_moy@yahoo.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Chessboard generator gem for Rails 5 apps.}
|
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
|
14
|
+
spec.homepage = "https://github.com/dhrubomoy/chessboard"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
# if spec.respond_to?(:metadata)
|
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
# else
|
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
33
|
+
spec.add_development_dependency 'rails', '~> 5.0.0', '>= 5.0.0.1'
|
|
34
|
+
end
|
data/lib/chessboard.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Generates controller, view, javascripts and stylesheets for a chessboard.
|
|
3
|
+
|
|
4
|
+
Example:
|
|
5
|
+
rails generate chessboard
|
|
6
|
+
|
|
7
|
+
This will create:
|
|
8
|
+
vendor/assets/javascript/chess.min.js
|
|
9
|
+
vendor/assets/javascript/chessboard-0.3.0.min.js
|
|
10
|
+
vendor/assets/stylesheets/chessboard-0.3.0.min.css
|
|
11
|
+
app/controllers/chessboard_controller.rb
|
|
12
|
+
app/assets/images/chesspieces/<Images>.png
|
|
13
|
+
app/views/chessboard/chessboard.html.erb
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
class ChessboardGenerator < Rails::Generators::Base
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
argument :chessboard_name, type: :string, default: 'chessboard'
|
|
4
|
+
class_option :skip_controller, type: :boolean, defalt: false, desc: 'Skip including chessboard controller.'
|
|
5
|
+
class_option :skip_route, type: :boolean, default: false, desc: 'Skip adding route for chessboard in your config/route.rb'
|
|
6
|
+
class_option :skip_view, type: :boolean, defalt: false, desc: 'Skip including chessboard view (.html.erb file).'
|
|
7
|
+
class_option :chessboard_type, type: :string, default: 'only_legal_moves', desc: "Specify what type of chessboard you want in your view.
|
|
8
|
+
Available options:
|
|
9
|
+
only_legal_moves,
|
|
10
|
+
play_random_computer,
|
|
11
|
+
empty_board,
|
|
12
|
+
random_vs_random,
|
|
13
|
+
highlight_legal_moves,
|
|
14
|
+
piece_highlighting_1,
|
|
15
|
+
piece_highlighting_2"
|
|
16
|
+
|
|
17
|
+
def generate_chessboard_assets
|
|
18
|
+
copy_file 'chess.min.js', 'vendor/assets/javascripts/chess.min.js'
|
|
19
|
+
copy_file 'chessboard-0.3.0.min.js', 'vendor/assets/javascripts/chessboard-0.3.0.min.js'
|
|
20
|
+
copy_file 'chessboard-0.3.0.min.css', 'vendor/assets/stylesheets/chessboard-0.3.0.min.css'
|
|
21
|
+
inject_into_file 'app/assets/stylesheets/application.css', " *= require chessboard-0.3.0.min\n", after: " *= require_self\n"
|
|
22
|
+
inject_into_file 'app/assets/javascripts/application.js', "//= require chessboard-0.3.0.min\n//= require chess.min\n", after: "//= require jquery_ujs\n"
|
|
23
|
+
directory 'chesspieces', "app/assets/images/chesspieces"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def generate_chessboard_controller
|
|
27
|
+
copy_file 'chessboard_controller.rb', 'app/controllers/chessboard_controller.rb' if !options.skip_controller
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def generate_chessboard_view
|
|
31
|
+
if !options.skip_view?
|
|
32
|
+
chessboard_view_path = 'app/views/chessboard/chessboard.html.erb'
|
|
33
|
+
case options.chessboard_type
|
|
34
|
+
when 'empty_board'
|
|
35
|
+
copy_file 'chessboard_empty_board.html.erb', chessboard_view_path
|
|
36
|
+
when 'only_legal_moves'
|
|
37
|
+
copy_file 'chessboard_only_legal_moves.html.erb', chessboard_view_path
|
|
38
|
+
when 'play_random_computer'
|
|
39
|
+
copy_file 'chessboard_play_random_computer.html.erb', chessboard_view_path
|
|
40
|
+
when 'random_vs_random'
|
|
41
|
+
copy_file 'chessboard_random_vs_random.html.erb', chessboard_view_path
|
|
42
|
+
when 'highlight_legal_moves'
|
|
43
|
+
copy_file 'chessboard_highlight_legal_moves.html.erb', chessboard_view_path
|
|
44
|
+
when 'piece_highlighting_1'
|
|
45
|
+
copy_file 'chessboard_piece_highlighting_1.html.erb', chessboard_view_path
|
|
46
|
+
when 'piece_highlighting_2'
|
|
47
|
+
copy_file 'chessboard_piece_highlighting_2.html.erb', chessboard_view_path
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def inject_into_routes
|
|
53
|
+
inject_into_file 'config/routes.rb', "get '/chessboard', to: 'chessboard#chessboard'\n", after: "Rails.application.routes.draw do\n" if !options.skip_routes
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* @license
|
|
2
|
+
* Copyright (c) 2016, Jeff Hlywa (jhlywa@gmail.com)
|
|
3
|
+
* Released under the BSD license
|
|
4
|
+
* https://github.com/jhlywa/chess.js/blob/master/LICENSE
|
|
5
|
+
*/
|
|
6
|
+
var Chess=function(r){function e(){ur=new Array(128),lr={w:x,b:x},sr=U,pr={w:0,b:0},cr=x,vr=0,gr=1,hr=[],dr={},a(i())}function n(){t(H)}function t(r){var n=r.split(/\s+/),t=n[0],f=0;if(!o(r).valid)return!1;e();for(var u=0;u<t.length;u++){var s=t.charAt(u);if("/"===s)f+=8;else if(O(s))f+=parseInt(s,10);else{var p="a">s?U:Q;l({type:s.toLowerCase(),color:p},R(f)),f++}}return sr=n[1],n[2].indexOf("K")>-1&&(pr.w|=er.KSIDE_CASTLE),n[2].indexOf("Q")>-1&&(pr.w|=er.QSIDE_CASTLE),n[2].indexOf("k")>-1&&(pr.b|=er.KSIDE_CASTLE),n[2].indexOf("q")>-1&&(pr.b|=er.QSIDE_CASTLE),cr="-"===n[3]?x:fr[n[3]],vr=parseInt(n[4],10),gr=parseInt(n[5],10),a(i()),!0}function o(r){var e={0:"No errors.",1:"FEN string must contain six space-delimited fields.",2:"6th field (move number) must be a positive integer.",3:"5th field (half move counter) must be a non-negative integer.",4:"4th field (en-passant square) is invalid.",5:"3rd field (castling availability) is invalid.",6:"2nd field (side to move) is invalid.",7:"1st field (piece positions) does not contain 8 '/'-delimited rows.",8:"1st field (piece positions) is invalid [consecutive numbers].",9:"1st field (piece positions) is invalid [invalid piece].",10:"1st field (piece positions) is invalid [row too large].",11:"Illegal en-passant square"},n=r.split(/\s+/);if(6!==n.length)return{valid:!1,error_number:1,error:e[1]};if(isNaN(n[5])||parseInt(n[5],10)<=0)return{valid:!1,error_number:2,error:e[2]};if(isNaN(n[4])||parseInt(n[4],10)<0)return{valid:!1,error_number:3,error:e[3]};if(!/^(-|[abcdefgh][36])$/.test(n[3]))return{valid:!1,error_number:4,error:e[4]};if(!/^(KQ?k?q?|Qk?q?|kq?|q|-)$/.test(n[2]))return{valid:!1,error_number:5,error:e[5]};if(!/^(w|b)$/.test(n[1]))return{valid:!1,error_number:6,error:e[6]};var t=n[0].split("/");if(8!==t.length)return{valid:!1,error_number:7,error:e[7]};for(var o=0;o<t.length;o++){for(var i=0,f=!1,a=0;a<t[o].length;a++)if(isNaN(t[o][a])){if(!/^[prnbqkPRNBQK]$/.test(t[o][a]))return{valid:!1,error_number:9,error:e[9]};i+=1,f=!1}else{if(f)return{valid:!1,error_number:8,error:e[8]};i+=parseInt(t[o][a],10),f=!0}if(8!==i)return{valid:!1,error_number:10,error:e[10]}}return"3"==n[3][1]&&"w"==n[1]||"6"==n[3][1]&&"b"==n[1]?{valid:!1,error_number:11,error:e[11]}:{valid:!0,error_number:0,error:e[0]}}function i(){for(var r=0,e="",n=fr.a8;n<=fr.h1;n++){if(null==ur[n])r++;else{r>0&&(e+=r,r=0);var t=ur[n].color,o=ur[n].type;e+=t===U?o.toUpperCase():o.toLowerCase()}n+1&136&&(r>0&&(e+=r),n!==fr.h1&&(e+="/"),r=0,n+=8)}var i="";pr[U]&er.KSIDE_CASTLE&&(i+="K"),pr[U]&er.QSIDE_CASTLE&&(i+="Q"),pr[Q]&er.KSIDE_CASTLE&&(i+="k"),pr[Q]&er.QSIDE_CASTLE&&(i+="q"),i=i||"-";var f=cr===x?"-":R(cr);return[e,sr,i,f,vr,gr].join(" ")}function f(r){for(var e=0;e<r.length;e+=2)"string"==typeof r[e]&&"string"==typeof r[e+1]&&(dr[r[e]]=r[e+1]);return dr}function a(r){hr.length>0||(r!==H?(dr.SetUp="1",dr.FEN=r):(delete dr.SetUp,delete dr.FEN))}function u(r){var e=ur[fr[r]];return e?{type:e.type,color:e.color}:null}function l(r,e){if(!("type"in r&&"color"in r))return!1;if(-1===W.indexOf(r.type.toLowerCase()))return!1;if(!(e in fr))return!1;var n=fr[e];return r.type==F&&lr[r.color]!=x&&lr[r.color]!=n?!1:(ur[n]={type:r.type,color:r.color},r.type===F&&(lr[r.color]=n),a(i()),!0)}function s(r){var e=u(r);return ur[fr[r]]=null,e&&e.type===F&&(lr[e.color]=x),a(i()),e}function p(r,e,n,t,o){var i={color:sr,from:e,to:n,flags:t,piece:r[e].type};return o&&(i.flags|=er.PROMOTION,i.promotion=o),r[n]?i.captured=r[n].type:t&er.EP_CAPTURE&&(i.captured=$),i}function c(r){function e(r,e,n,t,o){if(r[n].type!==$||w(t)!==ir&&w(t)!==nr)e.push(p(r,n,t,o));else for(var i=[G,M,B,j],f=0,a=i.length;a>f;f++)e.push(p(r,n,t,o,i[f]))}var n=[],t=sr,o=N(t),i={b:or,w:tr},f=fr.a8,a=fr.h1,u=!1,l="undefined"!=typeof r&&"legal"in r?r.legal:!0;if("undefined"!=typeof r&&"square"in r){if(!(r.square in fr))return[];f=a=fr[r.square],u=!0}for(var s=f;a>=s;s++)if(136&s)s+=7;else{var c=ur[s];if(null!=c&&c.color===t)if(c.type===$){var v=s+z[t][0];if(null==ur[v]){e(ur,n,s,v,er.NORMAL);var v=s+z[t][1];i[t]===w(s)&&null==ur[v]&&e(ur,n,s,v,er.BIG_PAWN)}for(g=2;4>g;g++){var v=s+z[t][g];136&v||(null!=ur[v]&&ur[v].color===o?e(ur,n,s,v,er.CAPTURE):v===cr&&e(ur,n,s,cr,er.EP_CAPTURE))}}else for(var g=0,E=J[c.type].length;E>g;g++)for(var b=J[c.type][g],v=s;;){if(v+=b,136&v)break;if(null!=ur[v]){if(ur[v].color===t)break;e(ur,n,s,v,er.CAPTURE);break}if(e(ur,n,s,v,er.NORMAL),"n"===c.type||"k"===c.type)break}}if(!u||a===lr[t]){if(pr[t]&er.KSIDE_CASTLE){var _=lr[t],y=_+2;null!=ur[_+1]||null!=ur[y]||h(o,lr[t])||h(o,_+1)||h(o,y)||e(ur,n,lr[t],y,er.KSIDE_CASTLE)}if(pr[t]&er.QSIDE_CASTLE){var _=lr[t],y=_-2;null!=ur[_-1]||null!=ur[_-2]||null!=ur[_-3]||h(o,lr[t])||h(o,_-1)||h(o,y)||e(ur,n,lr[t],y,er.QSIDE_CASTLE)}}if(!l)return n;for(var m=[],s=0,E=n.length;E>s;s++)S(n[s]),d(t)||m.push(n[s]),C();return m}function v(r,e){var n="";if(r.flags&er.KSIDE_CASTLE)n="O-O";else if(r.flags&er.QSIDE_CASTLE)n="O-O-O";else{var t=T(r,e);r.piece!==$&&(n+=r.piece.toUpperCase()+t),r.flags&(er.CAPTURE|er.EP_CAPTURE)&&(r.piece===$&&(n+=R(r.from)[0]),n+="x"),n+=R(r.to),r.flags&er.PROMOTION&&(n+="="+r.promotion.toUpperCase())}return S(r),E()&&(n+=b()?"#":"+"),C(),n}function g(r){return r.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function h(r,e){for(var n=fr.a8;n<=fr.h1;n++)if(136&n)n+=7;else if(null!=ur[n]&&ur[n].color===r){var t=ur[n],o=n-e,i=o+119;if(V[i]&1<<Y[t.type]){if(t.type===$){if(o>0){if(t.color===U)return!0}else if(t.color===Q)return!0;continue}if("n"===t.type||"k"===t.type)return!0;for(var f=X[i],a=n+f,u=!1;a!==e;){if(null!=ur[a]){u=!0;break}a+=f}if(!u)return!0}}return!1}function d(r){return h(N(r),lr[r])}function E(){return d(sr)}function b(){return E()&&0===c().length}function _(){return!E()&&0===c().length}function y(){for(var r={},e=[],n=0,t=0,o=fr.a8;o<=fr.h1;o++)if(t=(t+1)%2,136&o)o+=7;else{var i=ur[o];i&&(r[i.type]=i.type in r?r[i.type]+1:1,i.type===B&&e.push(t),n++)}if(2===n)return!0;if(3===n&&(1===r[B]||1===r[j]))return!0;if(n===r[B]+2){for(var f=0,a=e.length,o=0;a>o;o++)f+=e[o];if(0===f||f===a)return!0}return!1}function m(){for(var r=[],e={},n=!1;;){var t=C();if(!t)break;r.push(t)}for(;;){var o=i().split(" ").slice(0,4).join(" ");if(e[o]=o in e?e[o]+1:1,e[o]>=3&&(n=!0),!r.length)break;S(r.pop())}return n}function A(r){hr.push({move:r,kings:{b:lr.b,w:lr.w},turn:sr,castling:{b:pr.b,w:pr.w},ep_square:cr,half_moves:vr,move_number:gr})}function S(r){var e=sr,n=N(e);if(A(r),ur[r.to]=ur[r.from],ur[r.from]=null,r.flags&er.EP_CAPTURE&&(sr===Q?ur[r.to-16]=null:ur[r.to+16]=null),r.flags&er.PROMOTION&&(ur[r.to]={type:r.promotion,color:e}),ur[r.to].type===F){if(lr[ur[r.to].color]=r.to,r.flags&er.KSIDE_CASTLE){var t=r.to-1,o=r.to+1;ur[t]=ur[o],ur[o]=null}else if(r.flags&er.QSIDE_CASTLE){var t=r.to+1,o=r.to-2;ur[t]=ur[o],ur[o]=null}pr[e]=""}if(pr[e])for(var i=0,f=ar[e].length;f>i;i++)if(r.from===ar[e][i].square&&pr[e]&ar[e][i].flag){pr[e]^=ar[e][i].flag;break}if(pr[n])for(var i=0,f=ar[n].length;f>i;i++)if(r.to===ar[n][i].square&&pr[n]&ar[n][i].flag){pr[n]^=ar[n][i].flag;break}cr=r.flags&er.BIG_PAWN?"b"===sr?r.to-16:r.to+16:x,r.piece===$?vr=0:r.flags&(er.CAPTURE|er.EP_CAPTURE)?vr=0:vr++,sr===Q&&gr++,sr=N(sr)}function C(){var r=hr.pop();if(null==r)return null;var e=r.move;lr=r.kings,sr=r.turn,pr=r.castling,cr=r.ep_square,vr=r.half_moves,gr=r.move_number;var n=sr,t=N(sr);if(ur[e.from]=ur[e.to],ur[e.from].type=e.piece,ur[e.to]=null,e.flags&er.CAPTURE)ur[e.to]={type:e.captured,color:t};else if(e.flags&er.EP_CAPTURE){var o;o=n===Q?e.to-16:e.to+16,ur[o]={type:$,color:t}}if(e.flags&(er.KSIDE_CASTLE|er.QSIDE_CASTLE)){var i,f;e.flags&er.KSIDE_CASTLE?(i=e.to+1,f=e.to-1):e.flags&er.QSIDE_CASTLE&&(i=e.to-2,f=e.to+1),ur[i]=ur[f],ur[f]=null}return e}function T(r,e){for(var n=c({legal:!e}),t=r.from,o=r.to,i=r.piece,f=0,a=0,u=0,l=0,s=n.length;s>l;l++){var p=n[l].from,v=n[l].to,g=n[l].piece;i===g&&t!==p&&o===v&&(f++,w(t)===w(p)&&a++,L(t)===L(p)&&u++)}return f>0?a>0&&u>0?R(t):R(t).charAt(u>0?1:0):""}function I(){for(var r=" +------------------------+\n",e=fr.a8;e<=fr.h1;e++){if(0===L(e)&&(r+=" "+"87654321"[w(e)]+" |"),null==ur[e])r+=" . ";else{var n=ur[e].type,t=ur[e].color,o=t===U?n.toUpperCase():n.toLowerCase();r+=" "+o+" "}e+1&136&&(r+="|\n",e+=8)}return r+=" +------------------------+\n",r+=" a b c d e f g h\n"}function P(r,e){var n=g(r);if(e){var t=n.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/);if(t)var o=t[1],i=t[2],f=t[3],a=t[4]}for(var u=c(),l=0,s=u.length;s>l;l++){if(n===g(v(u[l]))||e&&n===g(v(u[l],!0)))return u[l];if(!(!t||o&&o.toLowerCase()!=u[l].piece||fr[i]!=u[l].from||fr[f]!=u[l].to||a&&a.toLowerCase()!=u[l].promotion))return u[l]}return null}function w(r){return r>>4}function L(r){return 15&r}function R(r){var e=L(r),n=w(r);return"abcdefgh".substring(e,e+1)+"87654321".substring(n,n+1)}function N(r){return r===U?Q:U}function O(r){return-1!=="0123456789".indexOf(r)}function k(r){var e=q(r);e.san=v(e,!1),e.to=R(e.to),e.from=R(e.from);var n="";for(var t in er)er[t]&e.flags&&(n+=rr[t]);return e.flags=n,e}function q(r){var e=r instanceof Array?[]:{};for(var n in r)"object"==typeof n?e[n]=q(r[n]):e[n]=r[n];return e}function D(r){return r.replace(/^\s+|\s+$/g,"")}function K(r){for(var e=c({legal:!1}),n=0,t=sr,o=0,i=e.length;i>o;o++){if(S(e[o]),!d(t))if(r-1>0){var f=K(r-1);n+=f}else n++;C()}return n}var Q="b",U="w",x=-1,$="p",j="n",B="b",M="r",G="q",F="k",W="pnbrqkPNBRQK",H="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",Z=["1-0","0-1","1/2-1/2","*"],z={b:[16,32,17,15],w:[-16,-32,-17,-15]},J={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},V=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],X=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],Y={p:0,n:1,b:2,r:3,q:4,k:5},rr={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},er={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},nr=7,tr=6,or=1,ir=0,fr={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},ar={w:[{square:fr.a1,flag:er.QSIDE_CASTLE},{square:fr.h1,flag:er.KSIDE_CASTLE}],b:[{square:fr.a8,flag:er.QSIDE_CASTLE},{square:fr.h8,flag:er.KSIDE_CASTLE}]},ur=new Array(128),lr={w:x,b:x},sr=U,pr={w:0,b:0},cr=x,vr=0,gr=1,hr=[],dr={};return t("undefined"==typeof r?H:r),{WHITE:U,BLACK:Q,PAWN:$,KNIGHT:j,BISHOP:B,ROOK:M,QUEEN:G,KING:F,SQUARES:function(){for(var r=[],e=fr.a8;e<=fr.h1;e++)136&e?e+=7:r.push(R(e));return r}(),FLAGS:rr,load:function(r){return t(r)},reset:function(){return n()},moves:function(r){for(var e=c(r),n=[],t=0,o=e.length;o>t;t++)n.push("undefined"!=typeof r&&"verbose"in r&&r.verbose?k(e[t]):v(e[t],!1));return n},in_check:function(){return E()},in_checkmate:function(){return b()},in_stalemate:function(){return _()},in_draw:function(){return vr>=100||_()||y()||m()},insufficient_material:function(){return y()},in_threefold_repetition:function(){return m()},game_over:function(){return vr>=100||b()||_()||y()||m()},validate_fen:function(r){return o(r)},fen:function(){return i()},pgn:function(r){var e="object"==typeof r&&"string"==typeof r.newline_char?r.newline_char:"\n",n="object"==typeof r&&"number"==typeof r.max_width?r.max_width:0,t=[],o=!1;for(var i in dr)t.push("["+i+' "'+dr[i]+'"]'+e),o=!0;o&&hr.length&&t.push(e);for(var f=[];hr.length>0;)f.push(C());for(var a=[],u="";f.length>0;){var l=f.pop();hr.length||"b"!==l.color?"w"===l.color&&(u.length&&a.push(u),u=gr+"."):u=gr+". ...",u=u+" "+v(l,!1),S(l)}if(u.length&&a.push(u),"undefined"!=typeof dr.Result&&a.push(dr.Result),0===n)return t.join("")+a.join(" ");for(var s=0,i=0;i<a.length;i++)s+a[i].length>n&&0!==i?(" "===t[t.length-1]&&t.pop(),t.push(e),s=0):0!==i&&(t.push(" "),s++),t.push(a[i]),s+=a[i].length;return t.join("")},load_pgn:function(r,e){function o(r){return r.replace(/\\/g,"\\")}function i(r){for(var e in r)return!0;return!1}function a(r,e){for(var n="object"==typeof e&&"string"==typeof e.newline_char?e.newline_char:"\r?\n",t={},i=r.split(new RegExp(o(n))),f="",a="",u=0;u<i.length;u++)f=i[u].replace(/^\[([A-Z][A-Za-z]*)\s.*\]$/,"$1"),a=i[u].replace(/^\[[A-Za-z]+\s"(.*)"\]$/,"$1"),D(f).length>0&&(t[f]=a);return t}var u="undefined"!=typeof e&&"sloppy"in e?e.sloppy:!1,l="object"==typeof e&&"string"==typeof e.newline_char?e.newline_char:"\r?\n",s=new RegExp("^(\\[(.|"+o(l)+")*\\])("+o(l)+")*1.("+o(l)+"|.)*$","g"),p=r.replace(s,"$1");"["!==p[0]&&(p=""),n();var c=a(p,e);for(var v in c)f([v,c[v]]);if("1"===c.SetUp&&!("FEN"in c&&t(c.FEN)))return!1;var g=r.replace(p,"").replace(new RegExp(o(l),"g")," ");g=g.replace(/(\{[^}]+\})+?/g,"");for(var h=/(\([^\(\)]+\))+?/g;h.test(g);)g=g.replace(h,"");g=g.replace(/\d+\.(\.\.)?/g,""),g=g.replace(/\.\.\./g,""),g=g.replace(/\$\d+/g,"");var d=D(g).split(new RegExp(/\s+/));d=d.join(",").replace(/,,+/g,",").split(",");for(var E="",b=0;b<d.length-1;b++){if(E=P(d[b],u),null==E)return!1;S(E)}if(E=d[d.length-1],Z.indexOf(E)>-1)i(dr)&&"undefined"==typeof dr.Result&&f(["Result",E]);else{if(E=P(E,u),null==E)return!1;S(E)}return!0},header:function(){return f(arguments)},ascii:function(){return I()},turn:function(){return sr},move:function(r,e){var n="undefined"!=typeof e&&"sloppy"in e?e.sloppy:!1,t=null;if("string"==typeof r)t=P(r,n);else if("object"==typeof r)for(var o=c(),i=0,f=o.length;f>i;i++)if(!(r.from!==R(o[i].from)||r.to!==R(o[i].to)||"promotion"in o[i]&&r.promotion!==o[i].promotion)){t=o[i];break}if(!t)return null;var a=k(t);return S(t),a},undo:function(){var r=C();return r?k(r):null},clear:function(){return e()},put:function(r,e){return l(r,e)},get:function(r){return u(r)},remove:function(r){return s(r)},perft:function(r){return K(r)},square_color:function(r){if(r in fr){var e=fr[r];return(w(e)+L(e))%2===0?"light":"dark"}return null},history:function(r){for(var e=[],n=[],t=("undefined"!=typeof r&&"verbose"in r&&r.verbose);hr.length>0;)e.push(C());for(;e.length>0;){var o=e.pop();n.push(t?k(o):v(o)),S(o)}return n}}};"undefined"!=typeof exports&&(exports.Chess=Chess),"undefined"!=typeof define&&define(function(){return Chess});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! chessboard.js v0.3.0 | (c) 2013 Chris Oakman | MIT License chessboardjs.com/license */
|
|
2
|
+
.clearfix-7da63{clear:both}.board-b72b1{border:2px solid #404040;-moz-box-sizing:content-box;box-sizing:content-box}.square-55d63{float:left;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.white-1e1d7{background-color:#f0d9b5;color:#b58863}.black-3c85d{background-color:#b58863;color:#f0d9b5}.highlight1-32417,.highlight2-9c5d2{-webkit-box-shadow:inset 0 0 3px 3px yellow;-moz-box-shadow:inset 0 0 3px 3px yellow;box-shadow:inset 0 0 3px 3px yellow}.notation-322f9{cursor:default;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;position:absolute}.alpha-d2270{bottom:1px;right:3px}.numeric-fc462{top:2px;left:2px}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*! chessboard.js v0.3.0 | (c) 2013 Chris Oakman | MIT License chessboardjs.com/license */
|
|
2
|
+
(function(){function l(f){return"string"!==typeof f?!1:-1!==f.search(/^[a-h][1-8]$/)}function Q(f){if("string"!==typeof f)return!1;f=f.replace(/ .+$/,"");f=f.split("/");if(8!==f.length)return!1;for(var b=0;8>b;b++)if(""===f[b]||8<f[b].length||-1!==f[b].search(/[^kqrbnpKQRNBP1-8]/))return!1;return!0}function F(f){if("object"!==typeof f)return!1;for(var b in f)if(!0===f.hasOwnProperty(b)){var n;(n=!0!==l(b))||(n=f[b],n="string"!==typeof n?!1:-1!==n.search(/^[bw][KQRNBP]$/),n=!0!==n);if(n)return!1}return!0}
|
|
3
|
+
function K(f){if(!0!==Q(f))return!1;f=f.replace(/ .+$/,"");f=f.split("/");for(var b={},n=8,m=0;8>m;m++){for(var l=f[m].split(""),r=0,w=0;w<l.length;w++)if(-1!==l[w].search(/[1-8]/))var I=parseInt(l[w],10),r=r+I;else{var I=b,F=B[r]+n,A;A=l[w];A=A.toLowerCase()===A?"b"+A.toUpperCase():"w"+A.toUpperCase();I[F]=A;r++}n--}return b}function L(f){if(!0!==F(f))return!1;for(var b="",n=8,m=0;8>m;m++){for(var l=0;8>l;l++){var r=B[l]+n;!0===f.hasOwnProperty(r)?(r=f[r].split(""),r="w"===r[0]?r[1].toUpperCase():
|
|
4
|
+
r[1].toLowerCase(),b+=r):b+="1"}7!==m&&(b+="/");n--}b=b.replace(/11111111/g,"8");b=b.replace(/1111111/g,"7");b=b.replace(/111111/g,"6");b=b.replace(/11111/g,"5");b=b.replace(/1111/g,"4");b=b.replace(/111/g,"3");return b=b.replace(/11/g,"2")}var B="abcdefgh".split("");window.ChessBoard=window.ChessBoard||function(f,b){function n(){return"xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx".replace(/x/g,function(a){return(16*Math.random()|0).toString(16)})}function m(a){return JSON.parse(JSON.stringify(a))}function X(a){a=
|
|
5
|
+
a.split(".");return{major:parseInt(a[0],10),minor:parseInt(a[1],10),patch:parseInt(a[2],10)}}function r(a,e,c){if(!0===b.hasOwnProperty("showErrors")&&!1!==b.showErrors){var d="ChessBoard Error "+a+": "+e;"console"===b.showErrors&&"object"===typeof console&&"function"===typeof console.log?(console.log(d),2<=arguments.length&&console.log(c)):"alert"===b.showErrors?(c&&(d+="\n\n"+JSON.stringify(c)),window.alert(d)):"function"===typeof b.showErrors&&b.showErrors(a,e,c)}}function w(a){return"fast"===
|
|
6
|
+
a||"slow"===a?!0:parseInt(a,10)+""!==a+""?!1:0<=a}function I(){for(var a=0;a<B.length;a++)for(var b=1;8>=b;b++){var c=B[a]+b;s[c]=c+"-"+n()}b="KQRBNP".split("");for(a=0;a<b.length;a++){var c="w"+b[a],d="b"+b[a];M[c]=c+"-"+n();M[d]=d+"-"+n()}}function ga(){var a='<div class="'+h.chessboard+'">';!0===b.sparePieces&&(a+='<div class="'+h.sparePieces+" "+h.sparePiecesTop+'"></div>');a+='<div class="'+h.board+'"></div>';!0===b.sparePieces&&(a+='<div class="'+h.sparePieces+" "+h.sparePiecesBottom+'"></div>');
|
|
7
|
+
return a+"</div>"}function A(a){"black"!==a&&(a="white");var e="",c=m(B),d=8;"black"===a&&(c.reverse(),d=1);for(var C="white",f=0;8>f;f++){for(var e=e+('<div class="'+h.row+'">'),k=0;8>k;k++){var g=c[k]+d,e=e+('<div class="'+h.square+" "+h[C]+" square-"+g+'" style="width: '+p+"px; height: "+p+'px" id="'+s[g]+'" data-square="'+g+'">');if(!0===b.showNotation){if("white"===a&&1===d||"black"===a&&8===d)e+='<div class="'+h.notation+" "+h.alpha+'">'+c[k]+"</div>";0===k&&(e+='<div class="'+h.notation+" "+
|
|
8
|
+
h.numeric+'">'+d+"</div>")}e+="</div>";C="white"===C?"black":"white"}e+='<div class="'+h.clearfix+'"></div></div>';C="white"===C?"black":"white";"white"===a?d--:d++}return e}function Y(a){if("function"===typeof b.pieceTheme)return b.pieceTheme(a);if("string"===typeof b.pieceTheme)return b.pieceTheme.replace(/{piece}/g,a);r(8272,"Unable to build image source for cfg.pieceTheme.");return""}function D(a,b,c){var d='<img src="'+Y(a)+'" ';c&&"string"===typeof c&&(d+='id="'+c+'" ');d+='alt="" class="'+
|
|
9
|
+
h.piece+'" data-piece="'+a+'" style="width: '+p+"px;height: "+p+"px;";!0===b&&(d+="display:none;");return d+'" />'}function N(a){var b="wK wQ wR wB wN wP".split(" ");"black"===a&&(b="bK bQ bR bB bN bP".split(" "));a="";for(var c=0;c<b.length;c++)a+=D(b[c],!1,M[b[c]]);return a}function ha(a,e,c,d){a=$("#"+s[a]);var C=a.offset(),f=$("#"+s[e]);e=f.offset();var k=n();$("body").append(D(c,!0,k));var g=$("#"+k);g.css({display:"",position:"absolute",top:C.top,left:C.left});a.find("."+h.piece).remove();g.animate(e,
|
|
10
|
+
{duration:b.moveSpeed,complete:function(){f.append(D(c));g.remove();"function"===typeof d&&d()}})}function ia(a,e,c){var d=$("#"+M[a]).offset(),f=$("#"+s[e]);e=f.offset();var g=n();$("body").append(D(a,!0,g));var k=$("#"+g);k.css({display:"",position:"absolute",left:d.left,top:d.top});k.animate(e,{duration:b.moveSpeed,complete:function(){f.find("."+h.piece).remove();f.append(D(a));k.remove();"function"===typeof c&&c()}})}function ja(a,e,c){function d(){f++;if(f===a.length&&(G(),!0===b.hasOwnProperty("onMoveEnd")&&
|
|
11
|
+
"function"===typeof b.onMoveEnd))b.onMoveEnd(m(e),m(c))}for(var f=0,g=0;g<a.length;g++)"clear"===a[g].type&&$("#"+s[a[g].square]+" ."+h.piece).fadeOut(b.trashSpeed,d),"add"===a[g].type&&!0!==b.sparePieces&&$("#"+s[a[g].square]).append(D(a[g].piece,!0)).find("."+h.piece).fadeIn(b.appearSpeed,d),"add"===a[g].type&&!0===b.sparePieces&&ia(a[g].piece,a[g].square,d),"move"===a[g].type&&ha(a[g].source,a[g].destination,a[g].piece,d)}function ka(a,b){a=a.split("");var c=B.indexOf(a[0])+1,d=parseInt(a[1],10);
|
|
12
|
+
b=b.split("");var g=B.indexOf(b[0])+1,f=parseInt(b[1],10),c=Math.abs(c-g),d=Math.abs(d-f);return c>=d?c:d}function la(a){for(var b=[],c=0;8>c;c++)for(var d=0;8>d;d++){var g=B[c]+(d+1);a!==g&&b.push({square:g,distance:ka(a,g)})}b.sort(function(a,b){return a.distance-b.distance});a=[];for(c=0;c<b.length;c++)a.push(b[c].square);return a}function G(){x.find("."+h.piece).remove();for(var a in g)!0===g.hasOwnProperty(a)&&$("#"+s[a]).append(D(g[a]))}function R(){x.html(A(u));G();!0===b.sparePieces&&("white"===
|
|
13
|
+
u?(S.html(N("black")),T.html(N("white"))):(S.html(N("white")),T.html(N("black"))))}function O(a){var e=m(g),c=m(a),d=L(e),f=L(c);if(d!==f){if(!0===b.hasOwnProperty("onChange")&&"function"===typeof b.onChange)b.onChange(e,c);g=a}}function U(a,b){for(var c in J)if(!0===J.hasOwnProperty(c)){var d=J[c];if(a>=d.left&&a<d.left+p&&b>=d.top&&b<d.top+p)return c}return"offboard"}function V(){x.find("."+h.square).removeClass(h.highlight1+" "+h.highlight2)}function ma(){function a(){G();y.css("display","none");
|
|
14
|
+
if(!0===b.hasOwnProperty("onSnapbackEnd")&&"function"===typeof b.onSnapbackEnd)b.onSnapbackEnd(E,t,m(g),u)}if("spare"===t)Z();else{V();var e=$("#"+s[t]).offset();y.animate(e,{duration:b.snapbackSpeed,complete:a});z=!1}}function Z(){V();var a=m(g);delete a[t];O(a);G();y.fadeOut(b.trashSpeed);z=!1}function na(a){V();var e=m(g);delete e[t];e[a]=E;O(e);e=$("#"+s[a]).offset();y.animate(e,{duration:b.snapSpeed,complete:function(){G();y.css("display","none");if(!0===b.hasOwnProperty("onSnapEnd")&&"function"===
|
|
15
|
+
typeof b.onSnapEnd)b.onSnapEnd(t,a,E)}});z=!1}function P(a,e,c,d){if("function"!==typeof b.onDragStart||!1!==b.onDragStart(a,e,m(g),u)){z=!0;E=e;t=a;H="spare"===a?"offboard":a;J={};for(var f in s)!0===s.hasOwnProperty(f)&&(J[f]=$("#"+s[f]).offset());y.attr("src",Y(e)).css({display:"",position:"absolute",left:c-p/2,top:d-p/2});"spare"!==a&&$("#"+s[a]).addClass(h.highlight1).find("."+h.piece).css("display","none")}}function aa(a,e){y.css({left:a-p/2,top:e-p/2});var c=U(a,e);if(c!==H){!0===l(H)&&$("#"+
|
|
16
|
+
s[H]).removeClass(h.highlight2);!0===l(c)&&$("#"+s[c]).addClass(h.highlight2);if("function"===typeof b.onDragMove)b.onDragMove(c,H,t,E,m(g),u);H=c}}function ba(a){var e="drop";"offboard"===a&&"snapback"===b.dropOffBoard&&(e="snapback");"offboard"===a&&"trash"===b.dropOffBoard&&(e="trash");if(!0===b.hasOwnProperty("onDrop")&&"function"===typeof b.onDrop){var c=m(g);"spare"===t&&!0===l(a)&&(c[a]=E);!0===l(t)&&"offboard"===a&&delete c[t];!0===l(t)&&!0===l(a)&&(delete c[t],c[a]=E);var d=m(g),c=b.onDrop(t,
|
|
17
|
+
a,E,c,d,u);if("snapback"===c||"trash"===c)e=c}"snapback"===e?ma():"trash"===e?Z():"drop"===e&&na(a)}function oa(a){a.preventDefault()}function pa(a){if(!0===b.draggable){var e=$(this).attr("data-square");!0===l(e)&&!0===g.hasOwnProperty(e)&&P(e,g[e],a.pageX,a.pageY)}}function qa(a){if(!0===b.draggable){var e=$(this).attr("data-square");!0===l(e)&&!0===g.hasOwnProperty(e)&&(a=a.originalEvent,P(e,g[e],a.changedTouches[0].pageX,a.changedTouches[0].pageY))}}function ra(a){if(!0===b.sparePieces){var e=
|
|
18
|
+
$(this).attr("data-piece");P("spare",e,a.pageX,a.pageY)}}function sa(a){if(!0===b.sparePieces){var e=$(this).attr("data-piece");a=a.originalEvent;P("spare",e,a.changedTouches[0].pageX,a.changedTouches[0].pageY)}}function ca(a){!0===z&&aa(a.pageX,a.pageY)}function ta(a){!0===z&&(a.preventDefault(),aa(a.originalEvent.changedTouches[0].pageX,a.originalEvent.changedTouches[0].pageY))}function da(a){!0===z&&(a=U(a.pageX,a.pageY),ba(a))}function ua(a){!0===z&&(a=U(a.originalEvent.changedTouches[0].pageX,
|
|
19
|
+
a.originalEvent.changedTouches[0].pageY),ba(a))}function va(a){if(!1===z&&(!0===b.hasOwnProperty("onMouseoverSquare")&&"function"===typeof b.onMouseoverSquare)&&(a=$(a.currentTarget).attr("data-square"),!0===l(a))){var e=!1;!0===g.hasOwnProperty(a)&&(e=g[a]);b.onMouseoverSquare(a,e,m(g),u)}}function wa(a){if(!1===z&&(!0===b.hasOwnProperty("onMouseoutSquare")&&"function"===typeof b.onMouseoutSquare)&&(a=$(a.currentTarget).attr("data-square"),!0===l(a))){var e=!1;!0===g.hasOwnProperty(a)&&(e=g[a]);
|
|
20
|
+
b.onMouseoutSquare(a,e,m(g),u)}}function xa(){$("body").on("mousedown mousemove","."+h.piece,oa);x.on("mousedown","."+h.square,pa);v.on("mousedown","."+h.sparePieces+" ."+h.piece,ra);x.on("mouseenter","."+h.square,va);x.on("mouseleave","."+h.square,wa);!0===(navigator&&navigator.userAgent&&-1!==navigator.userAgent.search(/MSIE/))?(document.ondragstart=function(){return!1},$("body").on("mousemove",ca),$("body").on("mouseup",da)):($(window).on("mousemove",ca),$(window).on("mouseup",da));!0==="ontouchstart"in
|
|
21
|
+
document.documentElement&&(x.on("touchstart","."+h.square,qa),v.on("touchstart","."+h.sparePieces+" ."+h.piece,sa),$(window).on("touchmove",ta),$(window).on("touchend",ua))}function ya(){v.html(ga());x=v.find("."+h.board);!0===b.sparePieces&&(S=v.find("."+h.sparePiecesTop),T=v.find("."+h.sparePiecesBottom));var a=n();$("body").append(D("wP",!0,a));y=$("#"+a);ea=parseInt(x.css("borderLeftWidth"),10);q.resize()}b=b||{};var fa=K("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"),h={alpha:"alpha-d2270",black:"black-3c85d",
|
|
22
|
+
board:"board-b72b1",chessboard:"chessboard-63f37",clearfix:"clearfix-7da63",highlight1:"highlight1-32417",highlight2:"highlight2-9c5d2",notation:"notation-322f9",numeric:"numeric-fc462",piece:"piece-417db",row:"row-5277c",sparePieces:"spare-pieces-7492f",sparePiecesBottom:"spare-pieces-bottom-ae20f",sparePiecesTop:"spare-pieces-top-4028b",square:"square-55d63",white:"white-1e1d7"},v,x,y,S,T,q={},ea=2,u="white",g={},p,E,H,t,z=!1,M={},s={},J;q.clear=function(a){q.position({},a)};q.destroy=function(){v.html("");
|
|
23
|
+
y.remove();v.unbind()};q.fen=function(){return q.position("fen")};q.flip=function(){q.orientation("flip")};q.move=function(){if(0!==arguments.length){for(var a=!0,b={},c=0;c<arguments.length;c++)if(!1===arguments[c])a=!1;else{var d;d=arguments[c];"string"!==typeof d?d=!1:(d=d.split("-"),d=2!==d.length?!1:!0===l(d[0])&&!0===l(d[1]));!0!==d?r(2826,"Invalid move passed to the move method.",arguments[c]):(d=arguments[c].split("-"),b[d[0]]=d[1])}var c=g,c=m(c),f;for(f in b)!0===b.hasOwnProperty(f)&&!0===
|
|
24
|
+
c.hasOwnProperty(f)&&(d=c[f],delete c[f],c[b[f]]=d);b=c;q.position(b,a);return b}};q.orientation=function(a){if(0===arguments.length)return u;"white"===a||"black"===a?(u=a,R()):"flip"===a?(u="white"===u?"black":"white",R()):r(5482,"Invalid value passed to the orientation method.",a)};q.position=function(a,b){if(0===arguments.length)return m(g);if("string"===typeof a&&"fen"===a.toLowerCase())return L(g);!1!==b&&(b=!0);"string"===typeof a&&"start"===a.toLowerCase()&&(a=m(fa));!0===Q(a)&&(a=K(a));if(!0!==
|
|
25
|
+
F(a))r(6482,"Invalid value passed to the position method.",a);else if(!0===b){var c=g,d=a,c=m(c),d=m(d),f=[],h={},k;for(k in d)!0===d.hasOwnProperty(k)&&(!0===c.hasOwnProperty(k)&&c[k]===d[k])&&(delete c[k],delete d[k]);for(k in d)if(!0===d.hasOwnProperty(k)){var l;a:{l=c;for(var n=d[k],s=la(k),p=0;p<s.length;p++){var q=s[p];if(!0===l.hasOwnProperty(q)&&l[q]===n){l=q;break a}}l=!1}!1!==l&&(f.push({type:"move",source:l,destination:k,piece:d[k]}),delete c[l],delete d[k],h[k]=!0)}for(k in d)!0===d.hasOwnProperty(k)&&
|
|
26
|
+
(f.push({type:"add",square:k,piece:d[k]}),delete d[k]);for(k in c)!0===c.hasOwnProperty(k)&&!0!==h.hasOwnProperty(k)&&(f.push({type:"clear",square:k,piece:c[k]}),delete c[k]);ja(f,g,a);O(a)}else O(a),G()};q.resize=function(){var a=parseInt(v.css("width"),10);if(!a||0>=a)p=0;else{for(a-=1;0!==a%8&&0<a;)a--;p=a/8}x.css("width",8*p+"px");y.css({height:p,width:p});!0===b.sparePieces&&v.find("."+h.sparePieces).css("paddingLeft",p+ea+"px");R()};q.start=function(a){q.position("start",a)};var W;if(W=!0===
|
|
27
|
+
function(){if("string"===typeof f){if(""===f)return window.alert("ChessBoard Error 1001: The first argument to ChessBoard() cannot be an empty string.\n\nExiting..."),!1;var a=document.getElementById(f);if(!a)return window.alert('ChessBoard Error 1002: Element with id "'+f+'" does not exist in the DOM.\n\nExiting...'),!1;v=$(a)}else if(v=$(f),1!==v.length)return window.alert("ChessBoard Error 1003: The first argument to ChessBoard() must be an ID or a single DOM node.\n\nExiting..."),!1;if(!window.JSON||
|
|
28
|
+
"function"!==typeof JSON.stringify||"function"!==typeof JSON.parse)return window.alert("ChessBoard Error 1004: JSON does not exist. Please include a JSON polyfill.\n\nExiting..."),!1;if(a=typeof window.$)if(a=$.fn)if(a=$.fn.jquery)var a=$.fn.jquery,b="1.7.0",a=X(a),b=X(b),a=!0===1E8*a.major+1E4*a.minor+a.patch>=1E8*b.major+1E4*b.minor+b.patch;return a?!0:(window.alert("ChessBoard Error 1005: Unable to find a valid version of jQuery. Please include jQuery 1.7.0 or higher on the page.\n\nExiting..."),
|
|
29
|
+
!1)}()){if("string"===typeof b||!0===F(b))b={position:b};"black"!==b.orientation&&(b.orientation="white");u=b.orientation;!1!==b.showNotation&&(b.showNotation=!0);!0!==b.draggable&&(b.draggable=!1);"trash"!==b.dropOffBoard&&(b.dropOffBoard="snapback");!0!==b.sparePieces&&(b.sparePieces=!1);!0===b.sparePieces&&(b.draggable=!0);if(!0!==b.hasOwnProperty("pieceTheme")||"string"!==typeof b.pieceTheme&&"function"!==typeof b.pieceTheme)b.pieceTheme="assets/chesspieces/wikipedia/{piece}.png";if(!0!==b.hasOwnProperty("appearSpeed")||
|
|
30
|
+
!0!==w(b.appearSpeed))b.appearSpeed=200;if(!0!==b.hasOwnProperty("moveSpeed")||!0!==w(b.moveSpeed))b.moveSpeed=200;if(!0!==b.hasOwnProperty("snapbackSpeed")||!0!==w(b.snapbackSpeed))b.snapbackSpeed=50;if(!0!==b.hasOwnProperty("snapSpeed")||!0!==w(b.snapSpeed))b.snapSpeed=25;if(!0!==b.hasOwnProperty("trashSpeed")||!0!==w(b.trashSpeed))b.trashSpeed=100;!0===b.hasOwnProperty("position")&&("start"===b.position?g=m(fa):!0===Q(b.position)?g=K(b.position):!0===F(b.position)?g=m(b.position):r(7263,"Invalid value passed to config.position.",
|
|
31
|
+
b.position));W=!0}W&&(I(),ya(),xa());return q};window.ChessBoard.fenToObj=K;window.ChessBoard.objToFen=L})();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<div id="board" style="width: 600px"></div>
|
|
2
|
+
|
|
3
|
+
<script type="text/javascript">
|
|
4
|
+
var board,
|
|
5
|
+
game = new Chess();
|
|
6
|
+
|
|
7
|
+
var removeGreySquares = function() {
|
|
8
|
+
$('#board .square-55d63').css('background', '');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var greySquare = function(square) {
|
|
12
|
+
var squareEl = $('#board .square-' + square);
|
|
13
|
+
|
|
14
|
+
var background = '#a9a9a9';
|
|
15
|
+
if (squareEl.hasClass('black-3c85d') === true) {
|
|
16
|
+
background = '#696969';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
squareEl.css('background', background);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var onDragStart = function(source, piece) {
|
|
23
|
+
// do not pick up pieces if the game is over
|
|
24
|
+
// or if it's not that side's turn
|
|
25
|
+
if (game.game_over() === true ||
|
|
26
|
+
(game.turn() === 'w' && piece.search(/^b/) !== -1) ||
|
|
27
|
+
(game.turn() === 'b' && piece.search(/^w/) !== -1)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var onDrop = function(source, target) {
|
|
33
|
+
removeGreySquares();
|
|
34
|
+
|
|
35
|
+
// see if the move is legal
|
|
36
|
+
var move = game.move({
|
|
37
|
+
from: source,
|
|
38
|
+
to: target,
|
|
39
|
+
promotion: 'q' // NOTE: always promote to a queen for example simplicity
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// illegal move
|
|
43
|
+
if (move === null) return 'snapback';
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var onMouseoverSquare = function(square, piece) {
|
|
47
|
+
// get list of possible moves for this square
|
|
48
|
+
var moves = game.moves({
|
|
49
|
+
square: square,
|
|
50
|
+
verbose: true
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// exit if there are no moves available for this square
|
|
54
|
+
if (moves.length === 0) return;
|
|
55
|
+
|
|
56
|
+
// highlight the square they moused over
|
|
57
|
+
greySquare(square);
|
|
58
|
+
|
|
59
|
+
// highlight the possible squares for this piece
|
|
60
|
+
for (var i = 0; i < moves.length; i++) {
|
|
61
|
+
greySquare(moves[i].to);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var onMouseoutSquare = function(square, piece) {
|
|
66
|
+
removeGreySquares();
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var onSnapEnd = function() {
|
|
70
|
+
board.position(game.fen());
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var cfg = {
|
|
74
|
+
draggable: true,
|
|
75
|
+
position: 'start',
|
|
76
|
+
onDragStart: onDragStart,
|
|
77
|
+
onDrop: onDrop,
|
|
78
|
+
onMouseoutSquare: onMouseoutSquare,
|
|
79
|
+
onMouseoverSquare: onMouseoverSquare,
|
|
80
|
+
onSnapEnd: onSnapEnd
|
|
81
|
+
};
|
|
82
|
+
board = ChessBoard('board', cfg);
|
|
83
|
+
</script>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<div id="board" style="width: 600px"></div>
|
|
2
|
+
<p>Status: <span id="status"></span></p>
|
|
3
|
+
|
|
4
|
+
<script type="text/javascript">
|
|
5
|
+
var board,
|
|
6
|
+
game = new Chess(),
|
|
7
|
+
statusEl = $('#status'),
|
|
8
|
+
fenEl = $('#fen'),
|
|
9
|
+
pgnEl = $('#pgn');
|
|
10
|
+
|
|
11
|
+
// do not pick up pieces if the game is over
|
|
12
|
+
// only pick up pieces for the side to move
|
|
13
|
+
var onDragStart = function(source, piece, position, orientation) {
|
|
14
|
+
if (game.game_over() === true ||
|
|
15
|
+
(game.turn() === 'w' && piece.search(/^b/) !== -1) ||
|
|
16
|
+
(game.turn() === 'b' && piece.search(/^w/) !== -1)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var onDrop = function(source, target) {
|
|
22
|
+
// see if the move is legal
|
|
23
|
+
var move = game.move({
|
|
24
|
+
from: source,
|
|
25
|
+
to: target,
|
|
26
|
+
promotion: 'q' // NOTE: always promote to a queen for example simplicity
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// illegal move
|
|
30
|
+
if (move === null) return 'snapback';
|
|
31
|
+
|
|
32
|
+
updateStatus();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// update the board position after the piece snap
|
|
36
|
+
// for castling, en passant, pawn promotion
|
|
37
|
+
var onSnapEnd = function() {
|
|
38
|
+
board.position(game.fen());
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var updateStatus = function() {
|
|
42
|
+
var status = '';
|
|
43
|
+
|
|
44
|
+
var moveColor = 'White';
|
|
45
|
+
if (game.turn() === 'b') {
|
|
46
|
+
moveColor = 'Black';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// checkmate?
|
|
50
|
+
if (game.in_checkmate() === true) {
|
|
51
|
+
status = 'Game over, ' + moveColor + ' is in checkmate.';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// draw?
|
|
55
|
+
else if (game.in_draw() === true) {
|
|
56
|
+
status = 'Game over, drawn position';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// game still on
|
|
60
|
+
else {
|
|
61
|
+
status = moveColor + ' to move';
|
|
62
|
+
|
|
63
|
+
// check?
|
|
64
|
+
if (game.in_check() === true) {
|
|
65
|
+
status += ', ' + moveColor + ' is in check';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
statusEl.html(status);
|
|
70
|
+
fenEl.html(game.fen());
|
|
71
|
+
pgnEl.html(game.pgn());
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var cfg = {
|
|
75
|
+
draggable: true,
|
|
76
|
+
position: 'start',
|
|
77
|
+
onDragStart: onDragStart,
|
|
78
|
+
onDrop: onDrop,
|
|
79
|
+
onSnapEnd: onSnapEnd
|
|
80
|
+
};
|
|
81
|
+
board = ChessBoard('board', cfg);
|
|
82
|
+
|
|
83
|
+
updateStatus();
|
|
84
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
.highlight-white {
|
|
3
|
+
-webkit-box-shadow: inset 0 0 3px 3px yellow;
|
|
4
|
+
-moz-box-shadow: inset 0 0 3px 3px yellow;
|
|
5
|
+
box-shadow: inset 0 0 3px 3px yellow;
|
|
6
|
+
}
|
|
7
|
+
.highlight-black {
|
|
8
|
+
-webkit-box-shadow: inset 0 0 3px 3px blue;
|
|
9
|
+
-moz-box-shadow: inset 0 0 3px 3px blue;
|
|
10
|
+
box-shadow: inset 0 0 3px 3px blue;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<div id="board" style="width: 600px"></div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<script type="text/javascript">
|
|
17
|
+
var board,
|
|
18
|
+
boardEl = $('#board'),
|
|
19
|
+
game = new Chess(),
|
|
20
|
+
squareClass = 'square-55d63',
|
|
21
|
+
squareToHighlight,
|
|
22
|
+
colorToHighlight;
|
|
23
|
+
|
|
24
|
+
var makeRandomMove = function() {
|
|
25
|
+
var possibleMoves = game.moves({
|
|
26
|
+
verbose: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// exit if the game is over
|
|
30
|
+
if (game.game_over() === true ||
|
|
31
|
+
game.in_draw() === true ||
|
|
32
|
+
possibleMoves.length === 0) return;
|
|
33
|
+
|
|
34
|
+
var randomIndex = Math.floor(Math.random() * possibleMoves.length);
|
|
35
|
+
var move = possibleMoves[randomIndex];
|
|
36
|
+
|
|
37
|
+
if (move.color === 'w') {
|
|
38
|
+
boardEl.find('.' + squareClass).removeClass('highlight-white');
|
|
39
|
+
boardEl.find('.square-' + move.from).addClass('highlight-white');
|
|
40
|
+
squareToHighlight = move.to;
|
|
41
|
+
colorToHighlight = 'white';
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
boardEl.find('.square-55d63').removeClass('highlight-black');
|
|
45
|
+
boardEl.find('.square-' + move.from).addClass('highlight-black');
|
|
46
|
+
squareToHighlight = move.to;
|
|
47
|
+
colorToHighlight = 'black';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
game.move(possibleMoves[randomIndex].san);
|
|
51
|
+
board.position(game.fen());
|
|
52
|
+
|
|
53
|
+
window.setTimeout(makeRandomMove, 1200);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var onMoveEnd = function() {
|
|
57
|
+
boardEl.find('.square-' + squareToHighlight)
|
|
58
|
+
.addClass('highlight-' + colorToHighlight);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var cfg = {
|
|
62
|
+
position: 'start',
|
|
63
|
+
onMoveEnd: onMoveEnd
|
|
64
|
+
};
|
|
65
|
+
board = ChessBoard('board', cfg);
|
|
66
|
+
|
|
67
|
+
window.setTimeout(makeRandomMove, 500);
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
.highlight-white {
|
|
3
|
+
-webkit-box-shadow: inset 0 0 3px 3px yellow;
|
|
4
|
+
-moz-box-shadow: inset 0 0 3px 3px yellow;
|
|
5
|
+
box-shadow: inset 0 0 3px 3px yellow;
|
|
6
|
+
}
|
|
7
|
+
.highlight-black {
|
|
8
|
+
-webkit-box-shadow: inset 0 0 3px 3px blue;
|
|
9
|
+
-moz-box-shadow: inset 0 0 3px 3px blue;
|
|
10
|
+
box-shadow: inset 0 0 3px 3px blue;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<div id="board" style="width: 600px"></div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<script type="text/javascript">
|
|
17
|
+
var board,
|
|
18
|
+
boardEl = $('#board'),
|
|
19
|
+
game = new Chess(),
|
|
20
|
+
squareToHighlight;
|
|
21
|
+
|
|
22
|
+
var removeHighlights = function(color) {
|
|
23
|
+
boardEl.find('.square-55d63')
|
|
24
|
+
.removeClass('highlight-' + color);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// do not pick up pieces if the game is over
|
|
28
|
+
// only pick up pieces for White
|
|
29
|
+
var onDragStart = function(source, piece, position, orientation) {
|
|
30
|
+
if (game.in_checkmate() === true || game.in_draw() === true ||
|
|
31
|
+
piece.search(/^b/) !== -1) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var makeRandomMove = function() {
|
|
37
|
+
var possibleMoves = game.moves({
|
|
38
|
+
verbose: true
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// game over
|
|
42
|
+
if (possibleMoves.length === 0) return;
|
|
43
|
+
|
|
44
|
+
var randomIndex = Math.floor(Math.random() * possibleMoves.length);
|
|
45
|
+
var move = possibleMoves[randomIndex];
|
|
46
|
+
game.move(move.san);
|
|
47
|
+
|
|
48
|
+
// highlight black's move
|
|
49
|
+
removeHighlights('black');
|
|
50
|
+
boardEl.find('.square-' + move.from).addClass('highlight-black');
|
|
51
|
+
squareToHighlight = move.to;
|
|
52
|
+
|
|
53
|
+
// update the board to the new position
|
|
54
|
+
board.position(game.fen());
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var onDrop = function(source, target) {
|
|
58
|
+
// see if the move is legal
|
|
59
|
+
var move = game.move({
|
|
60
|
+
from: source,
|
|
61
|
+
to: target,
|
|
62
|
+
promotion: 'q' // NOTE: always promote to a queen for example simplicity
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// illegal move
|
|
66
|
+
if (move === null) return 'snapback';
|
|
67
|
+
|
|
68
|
+
// highlight white's move
|
|
69
|
+
removeHighlights('white');
|
|
70
|
+
boardEl.find('.square-' + source).addClass('highlight-white');
|
|
71
|
+
boardEl.find('.square-' + target).addClass('highlight-white');
|
|
72
|
+
|
|
73
|
+
// make random move for black
|
|
74
|
+
window.setTimeout(makeRandomMove, 250);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var onMoveEnd = function() {
|
|
78
|
+
boardEl.find('.square-' + squareToHighlight)
|
|
79
|
+
.addClass('highlight-black');
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// update the board position after the piece snap
|
|
83
|
+
// for castling, en passant, pawn promotion
|
|
84
|
+
var onSnapEnd = function() {
|
|
85
|
+
board.position(game.fen());
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var cfg = {
|
|
89
|
+
draggable: true,
|
|
90
|
+
position: 'start',
|
|
91
|
+
onDragStart: onDragStart,
|
|
92
|
+
onDrop: onDrop,
|
|
93
|
+
onMoveEnd: onMoveEnd,
|
|
94
|
+
onSnapEnd: onSnapEnd
|
|
95
|
+
};
|
|
96
|
+
board = ChessBoard('board', cfg);
|
|
97
|
+
</script>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
.highlight-white {
|
|
3
|
+
-webkit-box-shadow: inset 0 0 3px 3px yellow;
|
|
4
|
+
-moz-box-shadow: inset 0 0 3px 3px yellow;
|
|
5
|
+
box-shadow: inset 0 0 3px 3px yellow;
|
|
6
|
+
}
|
|
7
|
+
.highlight-black {
|
|
8
|
+
-webkit-box-shadow: inset 0 0 3px 3px blue;
|
|
9
|
+
-moz-box-shadow: inset 0 0 3px 3px blue;
|
|
10
|
+
box-shadow: inset 0 0 3px 3px blue;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<div id="board" style="width: 600px"></div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
var board,
|
|
19
|
+
boardEl = $('#board'),
|
|
20
|
+
game = new Chess(),
|
|
21
|
+
squareToHighlight;
|
|
22
|
+
|
|
23
|
+
var removeHighlights = function(color) {
|
|
24
|
+
boardEl.find('.square-55d63')
|
|
25
|
+
.removeClass('highlight-' + color);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// do not pick up pieces if the game is over
|
|
29
|
+
// only pick up pieces for White
|
|
30
|
+
var onDragStart = function(source, piece, position, orientation) {
|
|
31
|
+
if (game.in_checkmate() === true || game.in_draw() === true ||
|
|
32
|
+
piece.search(/^b/) !== -1) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var makeRandomMove = function() {
|
|
38
|
+
var possibleMoves = game.moves({
|
|
39
|
+
verbose: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// game over
|
|
43
|
+
if (possibleMoves.length === 0) return;
|
|
44
|
+
|
|
45
|
+
var randomIndex = Math.floor(Math.random() * possibleMoves.length);
|
|
46
|
+
var move = possibleMoves[randomIndex];
|
|
47
|
+
game.move(move.san);
|
|
48
|
+
|
|
49
|
+
// highlight black's move
|
|
50
|
+
removeHighlights('black');
|
|
51
|
+
boardEl.find('.square-' + move.from).addClass('highlight-black');
|
|
52
|
+
squareToHighlight = move.to;
|
|
53
|
+
|
|
54
|
+
// update the board to the new position
|
|
55
|
+
board.position(game.fen());
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var onDrop = function(source, target) {
|
|
59
|
+
// see if the move is legal
|
|
60
|
+
var move = game.move({
|
|
61
|
+
from: source,
|
|
62
|
+
to: target,
|
|
63
|
+
promotion: 'q' // NOTE: always promote to a queen for example simplicity
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// illegal move
|
|
67
|
+
if (move === null) return 'snapback';
|
|
68
|
+
|
|
69
|
+
// highlight white's move
|
|
70
|
+
removeHighlights('white');
|
|
71
|
+
boardEl.find('.square-' + source).addClass('highlight-white');
|
|
72
|
+
boardEl.find('.square-' + target).addClass('highlight-white');
|
|
73
|
+
|
|
74
|
+
// make random move for black
|
|
75
|
+
window.setTimeout(makeRandomMove, 250);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var onMoveEnd = function() {
|
|
79
|
+
boardEl.find('.square-' + squareToHighlight)
|
|
80
|
+
.addClass('highlight-black');
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// update the board position after the piece snap
|
|
84
|
+
// for castling, en passant, pawn promotion
|
|
85
|
+
var onSnapEnd = function() {
|
|
86
|
+
board.position(game.fen());
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var cfg = {
|
|
90
|
+
draggable: true,
|
|
91
|
+
position: 'start',
|
|
92
|
+
onDragStart: onDragStart,
|
|
93
|
+
onDrop: onDrop,
|
|
94
|
+
onMoveEnd: onMoveEnd,
|
|
95
|
+
onSnapEnd: onSnapEnd
|
|
96
|
+
};
|
|
97
|
+
board = ChessBoard('board', cfg);
|
|
98
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<div id="board" style="width: 600px"></div>
|
|
2
|
+
|
|
3
|
+
<script type="text/javascript">
|
|
4
|
+
var board,
|
|
5
|
+
game = new Chess();
|
|
6
|
+
|
|
7
|
+
var makeRandomMove = function() {
|
|
8
|
+
var possibleMoves = game.moves();
|
|
9
|
+
|
|
10
|
+
// exit if the game is over
|
|
11
|
+
if (game.game_over() === true ||
|
|
12
|
+
game.in_draw() === true ||
|
|
13
|
+
possibleMoves.length === 0) return;
|
|
14
|
+
|
|
15
|
+
var randomIndex = Math.floor(Math.random() * possibleMoves.length);
|
|
16
|
+
game.move(possibleMoves[randomIndex]);
|
|
17
|
+
board.position(game.fen());
|
|
18
|
+
|
|
19
|
+
window.setTimeout(makeRandomMove, 500);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
board = ChessBoard('board', 'start');
|
|
23
|
+
|
|
24
|
+
window.setTimeout(makeRandomMove, 500);
|
|
25
|
+
</script>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: chessboard
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dhrubomoy Das Gupta
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 5.0.0
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: 5.0.0.1
|
|
65
|
+
type: :development
|
|
66
|
+
prerelease: false
|
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - "~>"
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: 5.0.0
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 5.0.0.1
|
|
75
|
+
description:
|
|
76
|
+
email:
|
|
77
|
+
- dhrubo_moy@yahoo.com
|
|
78
|
+
executables: []
|
|
79
|
+
extensions: []
|
|
80
|
+
extra_rdoc_files: []
|
|
81
|
+
files:
|
|
82
|
+
- ".gitignore"
|
|
83
|
+
- ".rspec"
|
|
84
|
+
- ".travis.yml"
|
|
85
|
+
- CODE_OF_CONDUCT.md
|
|
86
|
+
- Gemfile
|
|
87
|
+
- LICENSE.txt
|
|
88
|
+
- README.md
|
|
89
|
+
- Rakefile
|
|
90
|
+
- bin/console
|
|
91
|
+
- bin/setup
|
|
92
|
+
- chessboard.gemspec
|
|
93
|
+
- lib/chessboard.rb
|
|
94
|
+
- lib/chessboard/version.rb
|
|
95
|
+
- lib/generators/chessboard/USAGE
|
|
96
|
+
- lib/generators/chessboard/chessboard_generator.rb
|
|
97
|
+
- lib/generators/chessboard/templates/chess.min.js
|
|
98
|
+
- lib/generators/chessboard/templates/chessboard-0.3.0.min.css
|
|
99
|
+
- lib/generators/chessboard/templates/chessboard-0.3.0.min.js
|
|
100
|
+
- lib/generators/chessboard/templates/chessboard_controller.rb
|
|
101
|
+
- lib/generators/chessboard/templates/chessboard_empty_board.html.erb
|
|
102
|
+
- lib/generators/chessboard/templates/chessboard_highlight_legal_moves.html.erb
|
|
103
|
+
- lib/generators/chessboard/templates/chessboard_only_legal_moves.html.erb
|
|
104
|
+
- lib/generators/chessboard/templates/chessboard_piece_highlighting_1.html.erb
|
|
105
|
+
- lib/generators/chessboard/templates/chessboard_piece_highlighting_2.html.erb
|
|
106
|
+
- lib/generators/chessboard/templates/chessboard_play_random_computer.html.erb
|
|
107
|
+
- lib/generators/chessboard/templates/chessboard_random_vs_random.html.erb
|
|
108
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bB.png
|
|
109
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bK.png
|
|
110
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bN.png
|
|
111
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bP.png
|
|
112
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bQ.png
|
|
113
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/bR.png
|
|
114
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wB.png
|
|
115
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wK.png
|
|
116
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wN.png
|
|
117
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wP.png
|
|
118
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wQ.png
|
|
119
|
+
- lib/generators/chessboard/templates/chesspieces/wikipedia/wR.png
|
|
120
|
+
homepage: https://github.com/dhrubomoy/chessboard
|
|
121
|
+
licenses:
|
|
122
|
+
- MIT
|
|
123
|
+
metadata: {}
|
|
124
|
+
post_install_message:
|
|
125
|
+
rdoc_options: []
|
|
126
|
+
require_paths:
|
|
127
|
+
- lib
|
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
|
+
requirements:
|
|
130
|
+
- - ">="
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '0'
|
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
requirements: []
|
|
139
|
+
rubyforge_project:
|
|
140
|
+
rubygems_version: 2.5.1
|
|
141
|
+
signing_key:
|
|
142
|
+
specification_version: 4
|
|
143
|
+
summary: Chessboard generator gem for Rails 5 apps.
|
|
144
|
+
test_files: []
|