├── favicon.gif ├── favicon.ico ├── images ├── marble.jpg ├── king_black.png ├── king_white.png ├── pawn_black.png ├── pawn_white.png ├── rook_black.png ├── rook_white.png ├── small-logo.png ├── bishop_black.png ├── bishop_white.png ├── knight_black.png ├── knight_white.png ├── queen_black.png ├── queen_white.png ├── bjf-logo-color.png ├── thumb │ ├── king_black_thumb.png │ ├── king_white_thumb.png │ ├── pawn_black_thumb.png │ ├── pawn_white_thumb.png │ ├── queen_black_thumb.png │ ├── queen_white_thumb.png │ ├── rook_black_thumb.png │ ├── rook_white_thumb.png │ ├── bishop_black_thumb.png │ ├── bishop_white_thumb.png │ ├── knight_black_thumb.png │ └── knight_white_thumb.png └── ui │ ├── ui-icons_222222_256x240.png │ ├── ui-icons_4b8e0b_256x240.png │ ├── ui-icons_a83300_256x240.png │ ├── ui-icons_cccccc_256x240.png │ ├── ui-icons_ffffff_256x240.png │ ├── ui-bg_flat_30_cccccc_40x100.png │ ├── ui-bg_flat_50_5c5c5c_40x100.png │ ├── ui-bg_glass_20_555555_1x400.png │ ├── ui-bg_glass_40_0078a3_1x400.png │ ├── ui-bg_glass_40_ffc73d_1x400.png │ ├── ui-bg_inset-soft_25_000000_1x100.png │ ├── ui-bg_inset-soft_30_f58400_1x100.png │ ├── ui-bg_gloss-wave_25_333333_500x100.png │ └── ui-bg_highlight-soft_80_eeeeee_1x100.png ├── .gitignore ├── js ├── test.js ├── lib │ ├── head.min.js │ └── jquery │ │ └── jquery-ui-1.8.16.custom.min.js └── chess.js ├── index.html ├── test.html ├── README.md └── css ├── test.css └── style.css /favicon.gif: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/marble.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/marble.jpg -------------------------------------------------------------------------------- /images/king_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/king_black.png -------------------------------------------------------------------------------- /images/king_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/king_white.png -------------------------------------------------------------------------------- /images/pawn_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/pawn_black.png -------------------------------------------------------------------------------- /images/pawn_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/pawn_white.png -------------------------------------------------------------------------------- /images/rook_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/rook_black.png -------------------------------------------------------------------------------- /images/rook_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/rook_white.png -------------------------------------------------------------------------------- /images/small-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/small-logo.png -------------------------------------------------------------------------------- /images/bishop_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/bishop_black.png -------------------------------------------------------------------------------- /images/bishop_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/bishop_white.png -------------------------------------------------------------------------------- /images/knight_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/knight_black.png -------------------------------------------------------------------------------- /images/knight_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/knight_white.png -------------------------------------------------------------------------------- /images/queen_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/queen_black.png -------------------------------------------------------------------------------- /images/queen_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/queen_white.png -------------------------------------------------------------------------------- /images/bjf-logo-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/bjf-logo-color.png -------------------------------------------------------------------------------- /images/thumb/king_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/king_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/king_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/king_white_thumb.png -------------------------------------------------------------------------------- /images/thumb/pawn_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/pawn_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/pawn_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/pawn_white_thumb.png -------------------------------------------------------------------------------- /images/thumb/queen_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/queen_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/queen_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/queen_white_thumb.png -------------------------------------------------------------------------------- /images/thumb/rook_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/rook_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/rook_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/rook_white_thumb.png -------------------------------------------------------------------------------- /images/thumb/bishop_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/bishop_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/bishop_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/bishop_white_thumb.png -------------------------------------------------------------------------------- /images/thumb/knight_black_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/knight_black_thumb.png -------------------------------------------------------------------------------- /images/thumb/knight_white_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/thumb/knight_white_thumb.png -------------------------------------------------------------------------------- /images/ui/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /images/ui/ui-icons_4b8e0b_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-icons_4b8e0b_256x240.png -------------------------------------------------------------------------------- /images/ui/ui-icons_a83300_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-icons_a83300_256x240.png -------------------------------------------------------------------------------- /images/ui/ui-icons_cccccc_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-icons_cccccc_256x240.png -------------------------------------------------------------------------------- /images/ui/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /images/ui/ui-bg_flat_30_cccccc_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_flat_30_cccccc_40x100.png -------------------------------------------------------------------------------- /images/ui/ui-bg_flat_50_5c5c5c_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_flat_50_5c5c5c_40x100.png -------------------------------------------------------------------------------- /images/ui/ui-bg_glass_20_555555_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_glass_20_555555_1x400.png -------------------------------------------------------------------------------- /images/ui/ui-bg_glass_40_0078a3_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_glass_40_0078a3_1x400.png -------------------------------------------------------------------------------- /images/ui/ui-bg_glass_40_ffc73d_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_glass_40_ffc73d_1x400.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | .tmp* 4 | .project 5 | *.sass 6 | *.scss 7 | *.scssc 8 | config.rb 9 | css/scss 10 | 11 | /.settings -------------------------------------------------------------------------------- /images/ui/ui-bg_inset-soft_25_000000_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_inset-soft_25_000000_1x100.png -------------------------------------------------------------------------------- /images/ui/ui-bg_inset-soft_30_f58400_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_inset-soft_30_f58400_1x100.png -------------------------------------------------------------------------------- /images/ui/ui-bg_gloss-wave_25_333333_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_gloss-wave_25_333333_500x100.png -------------------------------------------------------------------------------- /images/ui/ui-bg_highlight-soft_80_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benjaminfisher/Web-Chess/HEAD/images/ui/ui-bg_highlight-soft_80_eeeeee_1x100.png -------------------------------------------------------------------------------- /js/test.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $('#clear').click(function(){ 3 | $('#board img').each(function(){ 4 | piece = $(this); 5 | if(!piece.attr('alt').match('king')) piece.remove(); 6 | }); 7 | Game.Players[0].pieces = []; 8 | Game.Players[0].pawns = []; 9 | Game.Players[1].pieces = []; 10 | Game.Players[1].pawns = []; 11 | 12 | $('.legal').removeClass('legal'); 13 | $('.selected').removeClass('selected'); 14 | $('.threat').removeClass('threat'); 15 | $('.attack').removeClass('attack'); 16 | }); 17 | 18 | $('#staging img').draggable({ 19 | containment: Game.board, 20 | helper: 'clone', 21 | opacity: 0.8, 22 | snap: true 23 | }); 24 | 25 | $('#board ul li').droppable({ 26 | drop: function(event, ui){ 27 | $dragging = $('.ui-draggable-dragging'); 28 | info = $dragging.attr('alt').split(' '); 29 | player = (Game.Players[0].color == info[0]) ? Game.Players[0] : Game.Players[1]; 30 | 31 | player.addPiece(info[1], this.id); 32 | } 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Web Chess 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 | 29 | 39 | 49 | 59 | 69 | 79 | 89 | 99 | 100 | 101 |
102 |
103 |
104 | 105 |
106 | 148 |
149 | 150 |
151 | 152 |

Turn:

153 |
154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 |
WhiteBlack
164 |
165 | 166 |
167 |
168 | 169 | 179 | 180 | -------------------------------------------------------------------------------- /test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Web Chess - Test Board 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 52 |
53 | 54 |
55 | 65 | 75 | 85 | 95 | 105 | 115 | 125 | 135 | 136 | 137 |
138 |
139 |
140 | 141 |
142 | 184 |
185 | 186 | 204 | 205 |
206 | 216 | 217 | -------------------------------------------------------------------------------- /js/lib/head.min.js: -------------------------------------------------------------------------------- 1 | (function(a,w){function f(a){p[p.length]=a}function m(a){q.className=q.className.replace(RegExp("\\b"+a+"\\b"),"")}function k(a,d){for(var b=0,c=a.length;ba?(c.screensCss.gt&&f("gt-"+a),c.screensCss.gte&&f("gte-"+ 2 | a)):bb);h.feature("landscape",dl?(c.browserCss.gt&&f("gt-"+i+l),c.browserCss.gte&&f("gte-"+i+l)):bb&&k("abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "), 6 | function(a){n.createElement(a)});k(t.pathname.split("/"),function(a,b){if(2b.documentMode))e.onload=e.onreadystatechange=e.onerror=null,c()};e.onerror=function(){e.onload=e.onreadystatechange=e.onerror=null;c()};e.async=!1;e.defer=!1;var d=b.head||b.getElementsByTagName("head")[0];d.insertBefore(e,d.lastChild)}function p(){b.body?u||(u=!0,m(h,function(a){r(a)})): 13 | (a.clearTimeout(d.readyTimeout),d.readyTimeout=a.setTimeout(p,50))}function c(){b.addEventListener?(b.removeEventListener("DOMContentLoaded",c,!1),p()):"complete"===b.readyState&&(b.detachEvent("onreadystatechange",c),p())}var b=a.document,h=[],v=[],x={},i={},A="async"in b.createElement("script")||"MozAppearance"in b.documentElement.style||a.opera,l,u,B=a.head_conf&&a.head_conf.head||"head",d=a[B]=a[B]||function(){d.ready.apply(null,arguments)},C=1,D=3,y=4;d.load=A?function(){var a=arguments,b=a[a.length- 14 | 1],e={};s(b)||(b=null);m(a,function(c,d){c!==b&&(c=n(c),e[c.name]=c,t(c,b&&d===a.length-2?function(){g(e)&&r(b)}:null))});return d}:function(){var a=arguments,b=[].slice.call(a,1),c=b[0];if(!l)return v.push(function(){d.load.apply(null,a)}),d;c?(m(b,function(a){if(!s(a)){var b=n(a);b.state===w&&(b.state=C,b.onpreload=[],q({url:b.url,type:"cache"},function(){b.state=2;m(b.onpreload,function(a){a.call()})}))}}),t(n(a[0]),s(c)?c:function(){d.load.apply(null,b)})):t(n(a[0]));return d};d.js=d.load;d.test= 15 | function(a,b,c,g){a="object"===typeof a?a:{test:a,success:b?k("Array",b)?b:[b]:!1,failure:c?k("Array",c)?c:[c]:!1,callback:g||f};(b=!!a.test)&&a.success?(a.success.push(a.callback),d.load.apply(null,a.success)):!b&&a.failure?(a.failure.push(a.callback),d.load.apply(null,a.failure)):g();return d};d.ready=function(a,c){if(a===b)return u?r(c):h.push(c),d;s(a)&&(c=a,a="ALL");if("string"!==typeof a||!s(c))return d;var e=i[a];if(e&&e.state===y||"ALL"===a&&g()&&u)return r(c),d;(e=x[a])?e.push(c):x[a]=[c]; 16 | return d};d.ready(b,function(){g()&&m(x.ALL,function(a){r(a)});d.feature&&d.feature("domloaded",!0)});if("complete"===b.readyState)p();else if(b.addEventListener)b.addEventListener("DOMContentLoaded",c,!1),a.addEventListener("load",p,!1);else{b.attachEvent("onreadystatechange",c);a.attachEvent("onload",p);var z=!1;try{z=null==a.frameElement&&b.documentElement}catch(F){}z&&z.doScroll&&function E(){if(!u){try{z.doScroll("left")}catch(b){a.clearTimeout(d.readyTimeout);d.readyTimeout=a.setTimeout(E,50); 17 | return}p()}}()}setTimeout(function(){l=!0;m(v,function(a){a()})},300)})(window); 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Web Chess 2 | ========= 3 | **A web-based Chess application using HTML5, CSS3 & JavaScript with jQuery** 4 | 5 | - **Author:** Benjamin Fisher 6 | - **Collaborator:** John-Michael Glenn 7 | - **Date:** January 2011 8 | 9 | - **Description:** Web based chess application. Layout is via HTML5 with CSS3 styling. 10 | Functionality is via JavaScript utilizing the jQuery library. 11 | Play is hot-seat between two players (no AI). 12 | 13 | ------------------------------------------------------------------------- 14 | 15 | _Version 12_ - All pieces but king are moving legally except en Passant capture. Footprint function added to pieces. 16 | _v12.1_ - Added basic king moves, still needs castle functionality & legality. 17 | _v12.2_ - Added castle legality & functionality, rook moves but looses its data 18 | _v12.3_ - Corrected rook issues when castling 19 | 20 | ^^^ B. Fisher ^^^ 21 | 22 | ------------------------------------------------------------------------- 23 | 24 | _Version 13_ - Revised CSS. Added marble background with opacity on the squares. << B. Fisher 25 | 26 | v13.1 - Added and corrected En Passant << J-M Glenn 27 | 28 | v13.3 - Removed the Player object from the Game object. Creating a Player sets up its pieces. 29 | Set Players as a global var. Turn changes reverses the Players array. << B. Fisher 30 | 31 | v13.2 - Fixed En Passant and implemented enPassant() function << J-M Glenn 32 | 33 | v13.4 - En Passant capture is fully functional including clearing the pawns EP variables at the end 34 | of the current player's turn. << B. Fisher 2/28 2100 35 | 36 | v13.5 - check function passed initial testing. Captured pieces need to be removed from Player pieces array << B. Fisher 3/1 0330 37 | 38 | ------------------------------------------------------------------------- 39 | 40 | _Version 14_ 41 | v14.3 - Moved capture functionality to the Player object. Pieces are now removed from the array on capture. 42 | Check function is working. Added Checkmate (comments only) and Stalemate function (untested). << B. Fisher 3/03 2200 43 | 44 | v14.4 - Modified check function to return checking pieces. << B. Fisher 3/04 0300 45 | 46 | v14.5 - Added skipKing option to the check function to prevent recursion over the Legal function. 47 | Legal is removing threatened squares from the kings legal moves. Still doesn't recognize protected pieces. 48 | Started adding movePiece functionality into the Piece.move() function. << B. Fisher 3/04 1930 49 | 50 | ------------------------------------------------------------------------- 51 | 52 | _Version 15_ - Removed the movePiece function. All piece movement is now handled by the individual piece objects 53 | and the Piece class. Revamped the Legality function to handle pawn capture and en passant legality. 54 | also disabled piece drag and drop due to issues with turn changes. << B. Fisher 3/05 2310 55 | 56 | v15.1 - Added pawn promotion << B. Fisher 3/06 0230 57 | 58 | v15.2 - Corrected issue with piece removal from pieces array on capture << B. Fisher 3/06 0430 59 | 60 | v15.3 - Added pinning check to Piece._move function. Detaches the piece and runs check before moving the piece. 61 | Still doesn't work fully, as the piece should still be able to move within the pinning vector << B. Fisher 3/07 2100 62 | 63 | v15.4 - Resolved pinned against king issues except when the pinning piece captures the pinner << B. Fisher 3/07 2115 64 | 65 | v15.5 - Still working on pinned against king issues. Pinning piece can move if not resulting in check. King in check isn't able to move 66 | except to take the checking piece due to recursion issues with Legal and check functions. << B. Fisher 3/10 0500 67 | 68 | ------------------------------------------------------------------------- 69 | 70 | _Version 16_ - Added resign button with gameOver and turnCount variables. << B. Fisher 3/10 1800 71 | 72 | v16.1 - Added the prison to display captured pieces << B. Fisher 33/10 1915 73 | 74 | v16.2 - Adding the move logging table along with it's styling << J-M Glenn 75 | 76 | v16.3 - Attempting to remove opposing king's footprint from moving king's available moves with the match function. 77 | Currently removing squares that should be legal. << B. Fisher 3/10 2215 78 | 79 | v16.4 - Added auto-scrolling to the move logger << J-M Glenn 80 | 81 | v16.5 - Added functionality for the 'prison' to show captured pieces. << B. Fisher 3/11 1830 82 | 83 | v16.6 - Removed pawns from player's pieces array, added to Player.pawns array. 84 | Resolved check issues. Corrected opponent pawn capture and move when requesting check function. Also corrected opponent king moves when 85 | calling check function. << B. Fisher 3/14 2200 86 | 87 | v16.7 - Simplified king.footprint function, now easier to parse feedback. << B. Fisher 88 | 89 | v16.8 - Added endGame function to cover the board and disable the resign button. << B. Fisher 3/16 1845 90 | 91 | ------------------------------------------------------------------------- 92 | 93 | _Version 17_ - Coded endGame function with scenarios for resignation, checkmate and stalemate. << B. Fisher 3/17 2130 94 | 95 | v17.1 - Coded move logging and specialty case of logging castling. << J-M Glenn 96 | 97 | ------------------------------------------------------------------------- 98 | 99 | _Version 18_ - Modifications to Legal function. The function now returns an array of pieces of the same color that the called piece interacts with. 100 | The legal moves are returned as the 'moves' key pair value. Will need to be called after a move finishes to find new protected pieces. 101 | << B. Fisher 3/21 102 | 103 | v18.1 - Cleaned up the logMove function. Consolidated duplicate creation and formatting. << B. Fisher 3/23 1930 104 | 105 | v18.2 - Added pawn promotion logging. << B. Fisher 3/29 106 | 107 | ------------------------------------------------------------------------- 108 | 109 | _Version 19_ - Wrapped all functionality within the Game object to remove global variables. 110 | Only active players pieces are outlined on hover, instead of all squares. << B. Fisher 5/6 111 | 112 | v19.1 - Corrected issues with removing pieces from player arrays on capture. << B. Fisher 5/23 113 | 114 | v19.2 - Removed code to hide elements with a class of .hidden, and added visibility:hidden property to CSS. 115 | Corrected issues with the div#cover and prison that resulted from this change. << B. Fisher 101311 116 | 117 | v19.5 - Adding Test environment and documentation files << B. Fisher 102511 118 | 119 | v19.6 - Moved documentation files to a seperate repo, hope to intigrate with webchess wiki page. 120 | Current round of optimization complete; all dependant methods moved outside of constructors. << B. Fisher 110811 121 | 122 | v19.7 - Removed Player name prompts, and added form to request player names. 123 | Also removed check alert; threatened king shows on red << B. Fisher 110911 124 | 125 | v19.8 - Resolved most of the issues with optimized code, including now king cannot capture protected pieces. 126 | Promoted pieces are being added to the piece array, and removed from array on capture. 127 | Also added attack class to show what opposing piece is attacking the king when in check. << B. Fisher 112311 128 | 129 | v19.9 - Player names captured via form. << B. Fisher 112911 130 | 131 | ------------------------------------------------------------------------- 132 | 133 | _Version 20_ - Merge optimize branch back into master. << B. Fisher 112911 134 | 135 | v20.1 - Removed prompts from pawn promotion. Move logging is glitching (logCell is incorrect after first promotion) << B. Fisher 113011 136 | 137 | v20.2 - Test Board is working. Able to drag and drop new pieces. Resolved check vector issues 138 | (king moving to threatened square that he blocked) except for opponent pieces adjacent 139 | to the king << B. Fisher 120711 140 | 141 | v20.3 - Stalemate is working << B. Fisher 120711 142 | + v20.3.1 - pawn promotion logging fixed << B. Fisher 120711 143 | 144 | v20.4 - All alerts removed. Style for cover notes and forms still needs some work. 145 | 146 | v20.5 - Converted to Compass project with SASS (sass files are not included in repo). 147 | 148 | 149 | ------------------------------------------------------------------------- 150 | 151 | _Version 21_ - Castle legality issue 152 | King can castle into check 153 | -------------------------------------------------------------------------------- /css/test.css: -------------------------------------------------------------------------------- 1 | html,body,div,#cover form,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,#log table tr:nth-child(odd),td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}html{line-height:1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:0}caption,th,#log table tr:nth-child(odd),td{text-align:left;font-weight:normal;vertical-align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:after{content:"";content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{display:block}body{background-color:maroon;font-family:Helvetica, Arial, sans-serif;overflow-x:hidden}img{z-index:10}#wrapper{width:100%;min-width:985px;float:left}.hidden{visibility:hidden}#board{background:url(../images/marble.jpg);border:4px outset gray;float:left;width:624px;height:624px;position:relative;margin:5px;padding:7px 0 0 7px}#board .label{bottom:1px;color:#222222;font-size:0.7em;left:2px;position:absolute;z-index:100;text-shadow:-1px -1px 0px #e0e0e0;filter:dropshadow(color=#e0e0e0, offx=-1, offy=-1)}#board ul{height:77px;width:616px;position:relative;background-color:rgba(255,255,255,0.5);color:#222}#board ul:first-child div:hover,#board ul:first-child #cover form:hover,#cover #board ul:first-child form:hover{margin-top:0}#board ul:nth-child(odd) li:nth-child(even){background-color:rgba(0,0,0,0.5)}#board ul:nth-child(odd) li:nth-child(even) .label{color:#C0C0C0;text-shadow:1px 1px 0px #333;filter:dropshadow(color=#ccc, offx=-1, offy=-1)}#board ul:nth-child(even) li:nth-child(odd){background-color:rgba(0,0,0,0.5)}#board ul:nth-child(even) li:nth-child(odd) .label{color:#C0C0C0;text-shadow:1px 1px 0px #333;filter:dropshadow(color=#ccc, offx=-1, offy=-1)}#board ul .selected{border:2px solid darkblue;height:73px;width:73px;z-index:5}#board ul .legal{background-color:rgba(0,0,200,0.6) !important}#board ul .legal:hover{background-color:rgba(0,100,200,0.6) !important;border:1px solid green}#board ul .threat{background-color:rgba(200,0,0,0.6) !important}#board ul .attack{background-color:rgba(0,200,0,0.6) !important}#board ul li{display:inline;float:left;position:relative;height:75px;width:75px;border:1px solid silver}#board ul li:first-child:hover{margin-left:0}#board ul li:not(.selected) img.active:hover{border:1px solid green;left:-1px;top:-1px}#board ul li img{display:block;position:relative}#cover{position:absolute;top:7px;left:7px;height:616px;width:616px;background-color:rgba(50,50,50,0.5);z-index:9000}#cover>div,#cover>form{-webkit-box-shadow:#fff 0px 0px 20px;-moz-box-shadow:#fff 0px 0px 20px;box-shadow:#fff 0px 0px 20px;-webkit-border-radius:20px;-moz-border-radius:20px;-ms-border-radius:20px;-o-border-radius:20px;border-radius:20px;color:#CCC;background:#333;height:285px;margin:0 auto;padding-top:1em;position:relative;text-align:center;top:157px;width:330px}#cover>div h1,#cover>form h1{font-size:1.5em;margin-bottom:2em}#cover>div h2,#cover>form h2{font-size:1.2em;letter-spacing:2px;margin-bottom:0.5em}#cover form label{margin-right:5px}#cover form button{position:relative;top:1em}#prison{float:left;height:624px;width:70px;display:block}#prison ul li{display:block;height:50px}#prison ul li[rel^='white']{color:white}#prison ul li span{position:relative;bottom:20px;left:-7px;z-index:5}#Dash{background-color:#FFF;border:2px outset gray;color:maroon;float:left;height:624px;line-height:24px;margin-top:5px;padding:5px;position:relative;min-width:200px;max-width:500px;width:22%}#Dash p{font-size:1.5em;margin:6px 0;padding:0 5px}#Dash button span{font-size:0.8em;padding:0.1em 0.7em}#logo{background:transparent url(../images/small-logo.png) top left no-repeat;display:inline-block;float:left;height:50px;margin-right:1em;position:relative;width:50px}#log{font:14px Arial, Helvetica, sans-serif;background-color:transparent;border:2px outset gray;color:#FFF;overflow-y:auto;height:530px;padding:3px;margin-top:24px;clear:left}#log table{background-color:transparent;border-color:black;border-collapse:separate;border-spacing:2px 2px;width:100%}#log table th,#log table tr:nth-child(odd){background-color:gray;text-align:center}#log table tr{border:1px solid}#log table tr:nth-child(even){background-color:darkgray}#log table tr td:last-child{color:black}#log table td{padding:1px}#log table thead th,#log table thead tr:nth-child(odd){width:50%}#log table thead th:last-child,#log table thead tr:last-child:nth-child(odd){color:black}.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute !important;clip:rect(1px 1px 1px 1px);clip:rect(1px, 1px, 1px, 1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix{display:inline-block}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default !important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:Segoe UI, Arial, sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Segoe UI, Arial, sans-serif;font-size:1em}.ui-widget-content{border:1px solid #666666;background:#000 url(../images/ui/ui-bg_inset-soft_25_000000_1x100.png) 50% bottom repeat-x;color:#ffffff}.ui-widget-content a{color:#ffffff}.ui-widget-header{border:1px solid #333333;background:#333 url(../images/ui/ui-bg_gloss-wave_25_333333_500x100.png) 50% 50% repeat-x;color:#ffffff;font-weight:bold}.ui-widget-header a{color:#ffffff}.ui-state-default,button,.ui-widget-content .ui-state-default,.ui-widget-content button,.ui-widget-header .ui-state-default,.ui-widget-header button{border:1px solid #666666;background:#555 url(../images/ui/ui-bg_glass_20_555555_1x400.png) 50% 50% repeat-x;font-weight:bold;color:#eeeeee}.ui-state-default a,button a{color:#eeeeee;text-decoration:none}.ui-state-default a:link,button a:link,.ui-state-default a:visited,button a:visited{color:#eeeeee;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #59b4d4;background:#0078a3 url(../images/ui/ui-bg_glass_40_0078a3_1x400.png) 50% 50% repeat-x;font-weight:bold;color:#ffffff}.ui-state-hover a{color:#ffffff;text-decoration:none}.ui-state-hover a:hover{color:#ffffff;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ffaf0f;background:#f58400 url(../images/ui/ui-bg_inset-soft_30_f58400_1x100.png) 50% 50% repeat-x;font-weight:bold;color:#ffffff}.ui-state-active a{color:#ffffff;text-decoration:none}.ui-state-active a:link,.ui-state-active a:visited{color:#ffffff;text-decoration:none}.ui-widget :active{outline:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #cccccc;background:#eee url(../images/ui/ui-bg_highlight-soft_80_eeeeee_1x100.png) 50% top repeat-x;color:#2e7db2}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2e7db2}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ffb73d;background:#ffc73d url(../images/ui/ui-bg_glass_40_ffc73d_1x400.png) 50% 50% repeat-x;color:#111111}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a,.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#111111}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(../images/ui/ui-icons_cccccc_256x240.png)}.ui-widget-content .ui-icon{background-image:url(../images/ui/ui-icons_cccccc_256x240.png)}.ui-widget-header .ui-icon{background-image:url(../images/ui/ui-icons_ffffff_256x240.png)}.ui-state-default .ui-icon,button .ui-icon{background-image:url(../images/ui/ui-icons_cccccc_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui/ui-icons_ffffff_256x240.png)}.ui-state-active .ui-icon{background-image:url(../images/ui/ui-icons_222222_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(../images/ui/ui-icons_4b8e0b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(../images/ui/ui-icons_a83300_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start,.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-left-radius:6px;border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:6px;-webkit-border-top-right-radius:6px;-khtml-border-top-right-radius:6px;border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-left-radius:6px;border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-right-radius:6px}.ui-widget-overlay{background:#5c5c5c url(../images/ui/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x;opacity:.80;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#ccc url(../images/ui/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x;opacity:.60;filter:Alpha(Opacity=60);-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none !important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em;padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-0.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}body{background:darkgreen}#staging{float:left}#staging img{z-index:100} -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | html, body, div, #cover form, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, #log table tr:nth-child(odd), td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 2 | margin: 0; 3 | padding: 0; 4 | border: 0; 5 | font-size: 100%; 6 | font: inherit; 7 | vertical-align: baseline 8 | } 9 | body { 10 | line-height: 1 11 | } 12 | ol, ul { 13 | list-style: none 14 | } 15 | table { 16 | border-collapse: collapse; 17 | border-spacing: 0 18 | } 19 | caption, th, #log table tr:nth-child(odd), td { 20 | text-align: left; 21 | font-weight: normal; 22 | vertical-align: middle 23 | } 24 | q, blockquote { 25 | quotes: none 26 | } 27 | q:before, q:after, blockquote:before, blockquote:after { 28 | content: ""; 29 | content: none 30 | } 31 | a img { 32 | border: none 33 | } 34 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { 35 | display: block 36 | } 37 | body { 38 | background-color: maroon; 39 | font-family: Helvetica, Arial, sans-serif; 40 | overflow-x: hidden 41 | } 42 | img { 43 | z-index: 10 44 | } 45 | #wrapper { 46 | width: 100%; 47 | min-width: 985px; 48 | float: left 49 | } 50 | .hidden { 51 | visibility: hidden 52 | } 53 | #board { 54 | background: url(../images/marble.jpg); 55 | border: 4px outset gray; 56 | float: left; 57 | width: 624px; 58 | height: 624px; 59 | position: relative; 60 | margin: 5px; 61 | padding: 7px 0 0 7px 62 | } 63 | #board .label { 64 | bottom: 1px; 65 | color: #222222; 66 | font-size: 0.7em; 67 | left: 2px; 68 | position: absolute; 69 | z-index: 100; 70 | text-shadow: -1px -1px 0px #e0e0e0; 71 | filter: dropshadow(color=#e0e0e0,offx=-1,offy=-1) 72 | } 73 | #board ul { 74 | height: 77px; 75 | width: 616px; 76 | position: relative; 77 | background-color: rgba(255,255,255,0.5); 78 | color: #222 79 | } 80 | #board ul:first-child div:hover, #board ul:first-child #cover form:hover, #cover #board ul:first-child form:hover { 81 | margin-top: 0 82 | } 83 | #board ul:nth-child(odd) li:nth-child(even) { 84 | background-color: rgba(0,0,0,0.5) 85 | } 86 | #board ul:nth-child(odd) li:nth-child(even) .label { 87 | color: #C0C0C0; 88 | text-shadow: 1px 1px 0px #333; 89 | filter: dropshadow(color=#ccc,offx=-1,offy=-1) 90 | } 91 | #board ul:nth-child(even) li:nth-child(odd) { 92 | background-color: rgba(0,0,0,0.5) 93 | } 94 | #board ul:nth-child(even) li:nth-child(odd) .label { 95 | color: #C0C0C0; 96 | text-shadow: 1px 1px 0px #333; 97 | filter: dropshadow(color=#ccc,offx=-1,offy=-1) 98 | } 99 | #board ul .selected { 100 | border: 2px solid darkblue; 101 | height: 73px; 102 | width: 73px; 103 | z-index: 5 104 | } 105 | #board ul .legal { 106 | background-color: rgba(0,0,200,0.6) !important 107 | } 108 | #board ul .legal:hover { 109 | background-color: rgba(0,100,200,0.6) !important; 110 | border: 1px solid green 111 | } 112 | #board ul .threat { 113 | background-color: rgba(200,0,0,0.6) !important 114 | } 115 | #board ul .attack { 116 | background-color: rgba(0,200,0,0.6) !important 117 | } 118 | #board ul li { 119 | display: inline; 120 | float: left; 121 | position: relative; 122 | height: 75px; 123 | width: 75px; 124 | border: 1px solid silver 125 | } 126 | #board ul li:first-child:hover { 127 | margin-left: 0 128 | } 129 | #board ul li:not(.selected) img.active:hover { 130 | border: 1px solid green; 131 | left: -1px; 132 | top: -1px 133 | } 134 | #board ul li img { 135 | display: block; 136 | position: relative 137 | } 138 | #cover { 139 | position: absolute; 140 | top: 7px; 141 | left: 7px; 142 | height: 616px; 143 | width: 616px; 144 | background-color: rgba(50,50,50,0.5); 145 | z-index: 9000 146 | } 147 | #cover > div, #cover > form { 148 | -moz-box-shadow: #fff 0px 0px 20px; 149 | -webkit-box-shadow: #fff 0px 0px 20px; 150 | -o-box-shadow: #fff 0px 0px 20px; 151 | box-shadow: #fff 0px 0px 20px; 152 | -moz-border-radius: 20px; 153 | -webkit-border-radius: 20px; 154 | -o-border-radius: 20px; 155 | -ms-border-radius: 20px; 156 | -khtml-border-radius: 20px; 157 | border-radius: 20px; 158 | color: #CCC; 159 | background: #333; 160 | margin: 0 auto; 161 | padding: 5% 0 15% 0; 162 | position: relative; 163 | text-align: center; 164 | top: 157px; 165 | width: 330px 166 | } 167 | #cover > div h1, #cover > form h1 { 168 | font-size: 1.5em; 169 | line-height:2em; 170 | } 171 | #cover > div h2, #cover > form h2 { 172 | font-size: 1.2em; 173 | letter-spacing: 2px; 174 | margin-bottom: 0.5em 175 | } 176 | #cover form label { 177 | margin-right: 5px 178 | } 179 | #cover form button { 180 | position: relative; 181 | top: 1em 182 | } 183 | #prison { 184 | float: left; 185 | height: 624px; 186 | width: 70px; 187 | display: block 188 | } 189 | #prison ul li { 190 | display: block; 191 | height: 50px 192 | } 193 | #prison ul li[rel^='white'] { 194 | color: white 195 | } 196 | #prison ul li span { 197 | position: relative; 198 | bottom: 20px; 199 | left: -7px; 200 | z-index: 5 201 | } 202 | #Dash { 203 | background-color: #FFF; 204 | border: 2px outset gray; 205 | color: maroon; 206 | float: left; 207 | height: 624px; 208 | line-height: 24px; 209 | margin-top: 5px; 210 | padding: 5px; 211 | position: relative; 212 | min-width: 200px; 213 | max-width: 500px; 214 | width: 22% 215 | } 216 | #Dash p { 217 | font-size: 1.5em; 218 | margin: 6px 0; 219 | padding: 0 5px 220 | } 221 | #Dash button span { 222 | font-size: 0.8em; 223 | padding: 0.1em 0.7em 224 | } 225 | #logo { 226 | background: transparent url(../images/small-logo.png) top left no-repeat; 227 | display: inline-block; 228 | float: left; 229 | height: 50px; 230 | margin-right: 1em; 231 | position: relative; 232 | width: 50px 233 | } 234 | #log { 235 | font: 14px Arial, Helvetica, sans-serif; 236 | background-color: transparent; 237 | border: 2px outset gray; 238 | color: #FFF; 239 | overflow-y: auto; 240 | height: 530px; 241 | padding: 3px; 242 | margin-top: 24px; 243 | clear: left 244 | } 245 | #log table { 246 | background-color: transparent; 247 | border-color: black; 248 | border-collapse: separate; 249 | border-spacing: 2px 2px; 250 | width: 100% 251 | } 252 | #log table th, #log table tr:nth-child(odd) { 253 | background-color: gray; 254 | text-align: center 255 | } 256 | #log table tr { 257 | border: 1px solid 258 | } 259 | #log table tr:nth-child(even) { 260 | background-color: darkgray 261 | } 262 | #log table tr td:last-child { 263 | color: black 264 | } 265 | #log table td { 266 | padding: 1px 267 | } 268 | #log table thead th, #log table thead tr:nth-child(odd) { 269 | width: 50% 270 | } 271 | #log table thead th:last-child, #log table thead tr:last-child:nth-child(odd) { 272 | color: black 273 | } 274 | .ui-helper-hidden { 275 | display: none 276 | } 277 | .ui-helper-hidden-accessible { 278 | position: absolute !important; 279 | clip: rect(1px 1px 1px 1px); 280 | clip: rect(1px,1px,1px,1px) 281 | } 282 | .ui-helper-reset { 283 | margin: 0; 284 | padding: 0; 285 | border: 0; 286 | outline: 0; 287 | line-height: 1.3; 288 | text-decoration: none; 289 | font-size: 100%; 290 | list-style: none 291 | } 292 | .ui-helper-clearfix { 293 | display: inline-block 294 | } 295 | .ui-helper-clearfix:after { 296 | content: "."; 297 | display: block; 298 | height: 0; 299 | clear: both; 300 | visibility: hidden 301 | } 302 | * html .ui-helper-clearfix { 303 | height: 1% 304 | } 305 | .ui-helper-clearfix { 306 | display: block 307 | } 308 | .ui-helper-zfix { 309 | width: 100%; 310 | height: 100%; 311 | top: 0; 312 | left: 0; 313 | position: absolute; 314 | opacity: 0; 315 | filter: Alpha(Opacity=0) 316 | } 317 | .ui-state-disabled { 318 | cursor: default !important 319 | } 320 | .ui-icon { 321 | display: block; 322 | text-indent: -99999px; 323 | overflow: hidden; 324 | background-repeat: no-repeat 325 | } 326 | .ui-widget-overlay { 327 | position: absolute; 328 | top: 0; 329 | left: 0; 330 | width: 100%; 331 | height: 100% 332 | } 333 | .ui-widget { 334 | font-family: Segoe UI, Arial, sans-serif; 335 | font-size: 1.1em 336 | } 337 | .ui-widget .ui-widget { 338 | font-size: 1em 339 | } 340 | .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { 341 | font-family: Segoe UI, Arial, sans-serif; 342 | font-size: 1em 343 | } 344 | .ui-widget-content { 345 | border: 1px solid #666666; 346 | background: #000 url(../images/ui/ui-bg_inset-soft_25_000000_1x100.png) 50% bottom repeat-x; 347 | color: #ffffff 348 | } 349 | .ui-widget-content a { 350 | color: #ffffff 351 | } 352 | .ui-widget-header { 353 | border: 1px solid #333333; 354 | background: #333 url(../images/ui/ui-bg_gloss-wave_25_333333_500x100.png) 50% 50% repeat-x; 355 | color: #ffffff; 356 | font-weight: bold 357 | } 358 | .ui-widget-header a { 359 | color: #ffffff 360 | } 361 | .ui-state-default, button, .ui-widget-content .ui-state-default, .ui-widget-content button, .ui-widget-header .ui-state-default, .ui-widget-header button { 362 | border: 1px solid #666666; 363 | background: #555 url(../images/ui/ui-bg_glass_20_555555_1x400.png) 50% 50% repeat-x; 364 | font-weight: bold; 365 | color: #eeeeee 366 | } 367 | .ui-state-default a, button a { 368 | color: #eeeeee; 369 | text-decoration: none 370 | } 371 | .ui-state-default a:link, button a:link, .ui-state-default a:visited, button a:visited { 372 | color: #eeeeee; 373 | text-decoration: none 374 | } 375 | .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { 376 | border: 1px solid #59b4d4; 377 | background: #0078a3 url(../images/ui/ui-bg_glass_40_0078a3_1x400.png) 50% 50% repeat-x; 378 | font-weight: bold; 379 | color: #ffffff 380 | } 381 | .ui-state-hover a { 382 | color: #ffffff; 383 | text-decoration: none 384 | } 385 | .ui-state-hover a:hover { 386 | color: #ffffff; 387 | text-decoration: none 388 | } 389 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { 390 | border: 1px solid #ffaf0f; 391 | background: #f58400 url(../images/ui/ui-bg_inset-soft_30_f58400_1x100.png) 50% 50% repeat-x; 392 | font-weight: bold; 393 | color: #ffffff 394 | } 395 | .ui-state-active a { 396 | color: #ffffff; 397 | text-decoration: none 398 | } 399 | .ui-state-active a:link, .ui-state-active a:visited { 400 | color: #ffffff; 401 | text-decoration: none 402 | } 403 | .ui-widget :active { 404 | outline: none 405 | } 406 | .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { 407 | border: 1px solid #cccccc; 408 | background: #eee url(../images/ui/ui-bg_highlight-soft_80_eeeeee_1x100.png) 50% top repeat-x; 409 | color: #2e7db2 410 | } 411 | .ui-state-highlight a, .ui-widget-content .ui-state-highlight a, .ui-widget-header .ui-state-highlight a { 412 | color: #2e7db2 413 | } 414 | .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { 415 | border: 1px solid #ffb73d; 416 | background: #ffc73d url(../images/ui/ui-bg_glass_40_ffc73d_1x400.png) 50% 50% repeat-x; 417 | color: #111111 418 | } 419 | .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a, .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { 420 | color: #111111 421 | } 422 | .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { 423 | font-weight: bold 424 | } 425 | .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { 426 | opacity: .7; 427 | filter: Alpha(Opacity=70); 428 | font-weight: normal 429 | } 430 | .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { 431 | opacity: .35; 432 | filter: Alpha(Opacity=35); 433 | background-image: none 434 | } 435 | .ui-icon { 436 | width: 16px; 437 | height: 16px; 438 | background-image: url(../images/ui/ui-icons_cccccc_256x240.png) 439 | } 440 | .ui-widget-content .ui-icon { 441 | background-image: url(../images/ui/ui-icons_cccccc_256x240.png) 442 | } 443 | .ui-widget-header .ui-icon { 444 | background-image: url(../images/ui/ui-icons_ffffff_256x240.png) 445 | } 446 | .ui-state-default .ui-icon, button .ui-icon { 447 | background-image: url(../images/ui/ui-icons_cccccc_256x240.png) 448 | } 449 | .ui-state-hover .ui-icon, .ui-state-focus .ui-icon { 450 | background-image: url(../images/ui/ui-icons_ffffff_256x240.png) 451 | } 452 | .ui-state-active .ui-icon { 453 | background-image: url(../images/ui/ui-icons_222222_256x240.png) 454 | } 455 | .ui-state-highlight .ui-icon { 456 | background-image: url(../images/ui/ui-icons_4b8e0b_256x240.png) 457 | } 458 | .ui-state-error .ui-icon, .ui-state-error-text .ui-icon { 459 | background-image: url(../images/ui/ui-icons_a83300_256x240.png) 460 | } 461 | .ui-icon-carat-1-n { 462 | background-position: 0 0 463 | } 464 | .ui-icon-carat-1-ne { 465 | background-position: -16px 0 466 | } 467 | .ui-icon-carat-1-e { 468 | background-position: -32px 0 469 | } 470 | .ui-icon-carat-1-se { 471 | background-position: -48px 0 472 | } 473 | .ui-icon-carat-1-s { 474 | background-position: -64px 0 475 | } 476 | .ui-icon-carat-1-sw { 477 | background-position: -80px 0 478 | } 479 | .ui-icon-carat-1-w { 480 | background-position: -96px 0 481 | } 482 | .ui-icon-carat-1-nw { 483 | background-position: -112px 0 484 | } 485 | .ui-icon-carat-2-n-s { 486 | background-position: -128px 0 487 | } 488 | .ui-icon-carat-2-e-w { 489 | background-position: -144px 0 490 | } 491 | .ui-icon-triangle-1-n { 492 | background-position: 0 -16px 493 | } 494 | .ui-icon-triangle-1-ne { 495 | background-position: -16px -16px 496 | } 497 | .ui-icon-triangle-1-e { 498 | background-position: -32px -16px 499 | } 500 | .ui-icon-triangle-1-se { 501 | background-position: -48px -16px 502 | } 503 | .ui-icon-triangle-1-s { 504 | background-position: -64px -16px 505 | } 506 | .ui-icon-triangle-1-sw { 507 | background-position: -80px -16px 508 | } 509 | .ui-icon-triangle-1-w { 510 | background-position: -96px -16px 511 | } 512 | .ui-icon-triangle-1-nw { 513 | background-position: -112px -16px 514 | } 515 | .ui-icon-triangle-2-n-s { 516 | background-position: -128px -16px 517 | } 518 | .ui-icon-triangle-2-e-w { 519 | background-position: -144px -16px 520 | } 521 | .ui-icon-arrow-1-n { 522 | background-position: 0 -32px 523 | } 524 | .ui-icon-arrow-1-ne { 525 | background-position: -16px -32px 526 | } 527 | .ui-icon-arrow-1-e { 528 | background-position: -32px -32px 529 | } 530 | .ui-icon-arrow-1-se { 531 | background-position: -48px -32px 532 | } 533 | .ui-icon-arrow-1-s { 534 | background-position: -64px -32px 535 | } 536 | .ui-icon-arrow-1-sw { 537 | background-position: -80px -32px 538 | } 539 | .ui-icon-arrow-1-w { 540 | background-position: -96px -32px 541 | } 542 | .ui-icon-arrow-1-nw { 543 | background-position: -112px -32px 544 | } 545 | .ui-icon-arrow-2-n-s { 546 | background-position: -128px -32px 547 | } 548 | .ui-icon-arrow-2-ne-sw { 549 | background-position: -144px -32px 550 | } 551 | .ui-icon-arrow-2-e-w { 552 | background-position: -160px -32px 553 | } 554 | .ui-icon-arrow-2-se-nw { 555 | background-position: -176px -32px 556 | } 557 | .ui-icon-arrowstop-1-n { 558 | background-position: -192px -32px 559 | } 560 | .ui-icon-arrowstop-1-e { 561 | background-position: -208px -32px 562 | } 563 | .ui-icon-arrowstop-1-s { 564 | background-position: -224px -32px 565 | } 566 | .ui-icon-arrowstop-1-w { 567 | background-position: -240px -32px 568 | } 569 | .ui-icon-arrowthick-1-n { 570 | background-position: 0 -48px 571 | } 572 | .ui-icon-arrowthick-1-ne { 573 | background-position: -16px -48px 574 | } 575 | .ui-icon-arrowthick-1-e { 576 | background-position: -32px -48px 577 | } 578 | .ui-icon-arrowthick-1-se { 579 | background-position: -48px -48px 580 | } 581 | .ui-icon-arrowthick-1-s { 582 | background-position: -64px -48px 583 | } 584 | .ui-icon-arrowthick-1-sw { 585 | background-position: -80px -48px 586 | } 587 | .ui-icon-arrowthick-1-w { 588 | background-position: -96px -48px 589 | } 590 | .ui-icon-arrowthick-1-nw { 591 | background-position: -112px -48px 592 | } 593 | .ui-icon-arrowthick-2-n-s { 594 | background-position: -128px -48px 595 | } 596 | .ui-icon-arrowthick-2-ne-sw { 597 | background-position: -144px -48px 598 | } 599 | .ui-icon-arrowthick-2-e-w { 600 | background-position: -160px -48px 601 | } 602 | .ui-icon-arrowthick-2-se-nw { 603 | background-position: -176px -48px 604 | } 605 | .ui-icon-arrowthickstop-1-n { 606 | background-position: -192px -48px 607 | } 608 | .ui-icon-arrowthickstop-1-e { 609 | background-position: -208px -48px 610 | } 611 | .ui-icon-arrowthickstop-1-s { 612 | background-position: -224px -48px 613 | } 614 | .ui-icon-arrowthickstop-1-w { 615 | background-position: -240px -48px 616 | } 617 | .ui-icon-arrowreturnthick-1-w { 618 | background-position: 0 -64px 619 | } 620 | .ui-icon-arrowreturnthick-1-n { 621 | background-position: -16px -64px 622 | } 623 | .ui-icon-arrowreturnthick-1-e { 624 | background-position: -32px -64px 625 | } 626 | .ui-icon-arrowreturnthick-1-s { 627 | background-position: -48px -64px 628 | } 629 | .ui-icon-arrowreturn-1-w { 630 | background-position: -64px -64px 631 | } 632 | .ui-icon-arrowreturn-1-n { 633 | background-position: -80px -64px 634 | } 635 | .ui-icon-arrowreturn-1-e { 636 | background-position: -96px -64px 637 | } 638 | .ui-icon-arrowreturn-1-s { 639 | background-position: -112px -64px 640 | } 641 | .ui-icon-arrowrefresh-1-w { 642 | background-position: -128px -64px 643 | } 644 | .ui-icon-arrowrefresh-1-n { 645 | background-position: -144px -64px 646 | } 647 | .ui-icon-arrowrefresh-1-e { 648 | background-position: -160px -64px 649 | } 650 | .ui-icon-arrowrefresh-1-s { 651 | background-position: -176px -64px 652 | } 653 | .ui-icon-arrow-4 { 654 | background-position: 0 -80px 655 | } 656 | .ui-icon-arrow-4-diag { 657 | background-position: -16px -80px 658 | } 659 | .ui-icon-extlink { 660 | background-position: -32px -80px 661 | } 662 | .ui-icon-newwin { 663 | background-position: -48px -80px 664 | } 665 | .ui-icon-refresh { 666 | background-position: -64px -80px 667 | } 668 | .ui-icon-shuffle { 669 | background-position: -80px -80px 670 | } 671 | .ui-icon-transfer-e-w { 672 | background-position: -96px -80px 673 | } 674 | .ui-icon-transferthick-e-w { 675 | background-position: -112px -80px 676 | } 677 | .ui-icon-folder-collapsed { 678 | background-position: 0 -96px 679 | } 680 | .ui-icon-folder-open { 681 | background-position: -16px -96px 682 | } 683 | .ui-icon-document { 684 | background-position: -32px -96px 685 | } 686 | .ui-icon-document-b { 687 | background-position: -48px -96px 688 | } 689 | .ui-icon-note { 690 | background-position: -64px -96px 691 | } 692 | .ui-icon-mail-closed { 693 | background-position: -80px -96px 694 | } 695 | .ui-icon-mail-open { 696 | background-position: -96px -96px 697 | } 698 | .ui-icon-suitcase { 699 | background-position: -112px -96px 700 | } 701 | .ui-icon-comment { 702 | background-position: -128px -96px 703 | } 704 | .ui-icon-person { 705 | background-position: -144px -96px 706 | } 707 | .ui-icon-print { 708 | background-position: -160px -96px 709 | } 710 | .ui-icon-trash { 711 | background-position: -176px -96px 712 | } 713 | .ui-icon-locked { 714 | background-position: -192px -96px 715 | } 716 | .ui-icon-unlocked { 717 | background-position: -208px -96px 718 | } 719 | .ui-icon-bookmark { 720 | background-position: -224px -96px 721 | } 722 | .ui-icon-tag { 723 | background-position: -240px -96px 724 | } 725 | .ui-icon-home { 726 | background-position: 0 -112px 727 | } 728 | .ui-icon-flag { 729 | background-position: -16px -112px 730 | } 731 | .ui-icon-calendar { 732 | background-position: -32px -112px 733 | } 734 | .ui-icon-cart { 735 | background-position: -48px -112px 736 | } 737 | .ui-icon-pencil { 738 | background-position: -64px -112px 739 | } 740 | .ui-icon-clock { 741 | background-position: -80px -112px 742 | } 743 | .ui-icon-disk { 744 | background-position: -96px -112px 745 | } 746 | .ui-icon-calculator { 747 | background-position: -112px -112px 748 | } 749 | .ui-icon-zoomin { 750 | background-position: -128px -112px 751 | } 752 | .ui-icon-zoomout { 753 | background-position: -144px -112px 754 | } 755 | .ui-icon-search { 756 | background-position: -160px -112px 757 | } 758 | .ui-icon-wrench { 759 | background-position: -176px -112px 760 | } 761 | .ui-icon-gear { 762 | background-position: -192px -112px 763 | } 764 | .ui-icon-heart { 765 | background-position: -208px -112px 766 | } 767 | .ui-icon-star { 768 | background-position: -224px -112px 769 | } 770 | .ui-icon-link { 771 | background-position: -240px -112px 772 | } 773 | .ui-icon-cancel { 774 | background-position: 0 -128px 775 | } 776 | .ui-icon-plus { 777 | background-position: -16px -128px 778 | } 779 | .ui-icon-plusthick { 780 | background-position: -32px -128px 781 | } 782 | .ui-icon-minus { 783 | background-position: -48px -128px 784 | } 785 | .ui-icon-minusthick { 786 | background-position: -64px -128px 787 | } 788 | .ui-icon-close { 789 | background-position: -80px -128px 790 | } 791 | .ui-icon-closethick { 792 | background-position: -96px -128px 793 | } 794 | .ui-icon-key { 795 | background-position: -112px -128px 796 | } 797 | .ui-icon-lightbulb { 798 | background-position: -128px -128px 799 | } 800 | .ui-icon-scissors { 801 | background-position: -144px -128px 802 | } 803 | .ui-icon-clipboard { 804 | background-position: -160px -128px 805 | } 806 | .ui-icon-copy { 807 | background-position: -176px -128px 808 | } 809 | .ui-icon-contact { 810 | background-position: -192px -128px 811 | } 812 | .ui-icon-image { 813 | background-position: -208px -128px 814 | } 815 | .ui-icon-video { 816 | background-position: -224px -128px 817 | } 818 | .ui-icon-script { 819 | background-position: -240px -128px 820 | } 821 | .ui-icon-alert { 822 | background-position: 0 -144px 823 | } 824 | .ui-icon-info { 825 | background-position: -16px -144px 826 | } 827 | .ui-icon-notice { 828 | background-position: -32px -144px 829 | } 830 | .ui-icon-help { 831 | background-position: -48px -144px 832 | } 833 | .ui-icon-check { 834 | background-position: -64px -144px 835 | } 836 | .ui-icon-bullet { 837 | background-position: -80px -144px 838 | } 839 | .ui-icon-radio-off { 840 | background-position: -96px -144px 841 | } 842 | .ui-icon-radio-on { 843 | background-position: -112px -144px 844 | } 845 | .ui-icon-pin-w { 846 | background-position: -128px -144px 847 | } 848 | .ui-icon-pin-s { 849 | background-position: -144px -144px 850 | } 851 | .ui-icon-play { 852 | background-position: 0 -160px 853 | } 854 | .ui-icon-pause { 855 | background-position: -16px -160px 856 | } 857 | .ui-icon-seek-next { 858 | background-position: -32px -160px 859 | } 860 | .ui-icon-seek-prev { 861 | background-position: -48px -160px 862 | } 863 | .ui-icon-seek-end { 864 | background-position: -64px -160px 865 | } 866 | .ui-icon-seek-start, .ui-icon-seek-first { 867 | background-position: -80px -160px 868 | } 869 | .ui-icon-stop { 870 | background-position: -96px -160px 871 | } 872 | .ui-icon-eject { 873 | background-position: -112px -160px 874 | } 875 | .ui-icon-volume-off { 876 | background-position: -128px -160px 877 | } 878 | .ui-icon-volume-on { 879 | background-position: -144px -160px 880 | } 881 | .ui-icon-power { 882 | background-position: 0 -176px 883 | } 884 | .ui-icon-signal-diag { 885 | background-position: -16px -176px 886 | } 887 | .ui-icon-signal { 888 | background-position: -32px -176px 889 | } 890 | .ui-icon-battery-0 { 891 | background-position: -48px -176px 892 | } 893 | .ui-icon-battery-1 { 894 | background-position: -64px -176px 895 | } 896 | .ui-icon-battery-2 { 897 | background-position: -80px -176px 898 | } 899 | .ui-icon-battery-3 { 900 | background-position: -96px -176px 901 | } 902 | .ui-icon-circle-plus { 903 | background-position: 0 -192px 904 | } 905 | .ui-icon-circle-minus { 906 | background-position: -16px -192px 907 | } 908 | .ui-icon-circle-close { 909 | background-position: -32px -192px 910 | } 911 | .ui-icon-circle-triangle-e { 912 | background-position: -48px -192px 913 | } 914 | .ui-icon-circle-triangle-s { 915 | background-position: -64px -192px 916 | } 917 | .ui-icon-circle-triangle-w { 918 | background-position: -80px -192px 919 | } 920 | .ui-icon-circle-triangle-n { 921 | background-position: -96px -192px 922 | } 923 | .ui-icon-circle-arrow-e { 924 | background-position: -112px -192px 925 | } 926 | .ui-icon-circle-arrow-s { 927 | background-position: -128px -192px 928 | } 929 | .ui-icon-circle-arrow-w { 930 | background-position: -144px -192px 931 | } 932 | .ui-icon-circle-arrow-n { 933 | background-position: -160px -192px 934 | } 935 | .ui-icon-circle-zoomin { 936 | background-position: -176px -192px 937 | } 938 | .ui-icon-circle-zoomout { 939 | background-position: -192px -192px 940 | } 941 | .ui-icon-circle-check { 942 | background-position: -208px -192px 943 | } 944 | .ui-icon-circlesmall-plus { 945 | background-position: 0 -208px 946 | } 947 | .ui-icon-circlesmall-minus { 948 | background-position: -16px -208px 949 | } 950 | .ui-icon-circlesmall-close { 951 | background-position: -32px -208px 952 | } 953 | .ui-icon-squaresmall-plus { 954 | background-position: -48px -208px 955 | } 956 | .ui-icon-squaresmall-minus { 957 | background-position: -64px -208px 958 | } 959 | .ui-icon-squaresmall-close { 960 | background-position: -80px -208px 961 | } 962 | .ui-icon-grip-dotted-vertical { 963 | background-position: 0 -224px 964 | } 965 | .ui-icon-grip-dotted-horizontal { 966 | background-position: -16px -224px 967 | } 968 | .ui-icon-grip-solid-vertical { 969 | background-position: -32px -224px 970 | } 971 | .ui-icon-grip-solid-horizontal { 972 | background-position: -48px -224px 973 | } 974 | .ui-icon-gripsmall-diagonal-se { 975 | background-position: -64px -224px 976 | } 977 | .ui-icon-grip-diagonal-se { 978 | background-position: -80px -224px 979 | } 980 | .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { 981 | -moz-border-radius-topleft: 6px; 982 | -webkit-border-top-left-radius: 6px; 983 | -khtml-border-top-left-radius: 6px; 984 | border-top-left-radius: 6px 985 | } 986 | .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { 987 | -moz-border-radius-topright: 6px; 988 | -webkit-border-top-right-radius: 6px; 989 | -khtml-border-top-right-radius: 6px; 990 | border-top-right-radius: 6px 991 | } 992 | .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { 993 | -moz-border-radius-bottomleft: 6px; 994 | -webkit-border-bottom-left-radius: 6px; 995 | -khtml-border-bottom-left-radius: 6px; 996 | border-bottom-left-radius: 6px 997 | } 998 | .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { 999 | -moz-border-radius-bottomright: 6px; 1000 | -webkit-border-bottom-right-radius: 6px; 1001 | -khtml-border-bottom-right-radius: 6px; 1002 | border-bottom-right-radius: 6px 1003 | } 1004 | .ui-widget-overlay { 1005 | background: #5c5c5c url(../images/ui/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x; 1006 | opacity: .80; 1007 | filter: Alpha(Opacity=80) 1008 | } 1009 | .ui-widget-shadow { 1010 | margin: -7px 0 0 -7px; 1011 | padding: 7px; 1012 | background: #ccc url(../images/ui/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x; 1013 | opacity: .60; 1014 | filter: Alpha(Opacity=60); 1015 | -moz-border-radius: 8px; 1016 | -khtml-border-radius: 8px; 1017 | -webkit-border-radius: 8px; 1018 | border-radius: 8px 1019 | } 1020 | .ui-button { 1021 | display: inline-block; 1022 | position: relative; 1023 | padding: 0; 1024 | margin-right: .1em; 1025 | text-decoration: none !important; 1026 | cursor: pointer; 1027 | text-align: center; 1028 | zoom: 1; 1029 | overflow: visible 1030 | } 1031 | .ui-button-icon-only { 1032 | width: 2.2em 1033 | } 1034 | button.ui-button-icon-only { 1035 | width: 2.4em 1036 | } 1037 | .ui-button-icons-only { 1038 | width: 3.4em 1039 | } 1040 | button.ui-button-icons-only { 1041 | width: 3.7em 1042 | } 1043 | .ui-button .ui-button-text { 1044 | display: block; 1045 | line-height: 1.4 1046 | } 1047 | .ui-button-text-only .ui-button-text { 1048 | padding: .4em 1em 1049 | } 1050 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { 1051 | padding: .4em; 1052 | text-indent: -9999999px 1053 | } 1054 | .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { 1055 | padding: .4em 1em .4em 2.1em 1056 | } 1057 | .ui-button-text-icon-secondary .ui-button-text { 1058 | padding: .4em 2.1em .4em 1em 1059 | } 1060 | .ui-button-text-icons .ui-button-text { 1061 | padding: .4em 2.1em .4em 1em; 1062 | padding-left: 2.1em; 1063 | padding-right: 2.1em 1064 | } 1065 | input.ui-button { 1066 | padding: .4em 1em 1067 | } 1068 | .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { 1069 | position: absolute; 1070 | top: 50%; 1071 | margin-top: -8px 1072 | } 1073 | .ui-button-icon-only .ui-icon { 1074 | left: 50%; 1075 | margin-left: -8px 1076 | } 1077 | .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { 1078 | left: .5em 1079 | } 1080 | .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { 1081 | right: .5em 1082 | } 1083 | .ui-buttonset { 1084 | margin-right: 7px 1085 | } 1086 | .ui-buttonset .ui-button { 1087 | margin-left: 0; 1088 | margin-right: -0.3em 1089 | } 1090 | button.ui-button::-moz-focus-inner { 1091 | border: 0; 1092 | padding: 0 1093 | } 1094 | -------------------------------------------------------------------------------- /js/chess.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Working on castle into check issue. Pushing latest version 3 | * @author Benjamin Fisher 4 | * @version 20.6 5 | * @constructor 6 | */ 7 | function Game() { 8 | var selectedSquare = null, gameOver = false, self = this; 9 | 10 | Game.board = $('#board'); 11 | /** Tracks the number of turns taken for move logging */ 12 | Game.turnCount = 1; 13 | /** {array} to hold the game's players. Players[0] is the current player */ 14 | Game.Players = []; 15 | /** {boolean} Controls whether to change the turn. Set to true if the current move is legal. */ 16 | Game.change = false; 17 | /** House keeping variable to track whether a castle took place on the current turn for move logging. */ 18 | Game.castled = null; 19 | 20 | Game.cLabels = "ABCDEFGH"; 21 | 22 | Game.board.find('ul li').click(function() { 23 | Game.square_click(this); 24 | }); 25 | 26 | $('#resign').button().click(function() { 27 | Game.endGame(1); 28 | }); 29 | 30 | Game.$cover = $('#cover'); 31 | 32 | //======================================================= 33 | 34 | /** 35 | * @constructor 36 | * @class 37 | * @extends Game 38 | * @param {string} name The player's name 39 | * @param {string} side The color of the Player's pieces 40 | */ 41 | Player = function() { 42 | var pCount = $(Game.Players).size(); 43 | 44 | /** Array to hold the Player's pieces */ 45 | this.pieces = []; 46 | 47 | /** Array to hold the Player's pawns */ 48 | this.pawns = []; 49 | 50 | this.color = (pCount === 0) ? 'white' : 'black'; 51 | 52 | /** {string} Players name (displayed in the dashboard) */ 53 | this.name = (name) ? name : 'Player ' + (pCount + 1); 54 | 55 | // The row where the Player's piece start the game 56 | // White Player starts on Row 1, Black on row 8 57 | var startRow = (this.color == 'white') ? 1 : 8, 58 | // Pawns start on the next medial row 59 | pawnRow = (this.color == 'white') ? 2 : 7; 60 | 61 | this.init(startRow, pawnRow); 62 | }; 63 | // End of Player() definition 64 | 65 | Player.prototype = { 66 | init : function(sRow, pRow) { 67 | for (var p = 0; p <= 7; p++) { 68 | this.addPiece('pawn', Game.cLabels[p] + pRow); 69 | } 70 | 71 | this.addPiece('rook', "A" + sRow); 72 | this.addPiece('rook', "H" + sRow); 73 | this.addPiece('knight', "B" + sRow); 74 | this.addPiece('knight', "G" + sRow); 75 | this.addPiece('bishop', "C" + sRow); 76 | this.addPiece('bishop', "F" + sRow); 77 | this.addPiece('queen', "D" + sRow); 78 | this.addPiece('king', "E" + sRow); 79 | }, 80 | 81 | /** 82 | * Add the active class to all pieces and pawns of the current player 83 | * @author BF 84 | */ 85 | activate : function() { 86 | $('.' + this.color).addClass('active'); 87 | }, 88 | 89 | /** 90 | * Create a new piece and add it to the correct array (pawns or pieces) for this player 91 | * @param [string] type What piece this is (e.g. queen, rook etc.) 92 | * @param [string] start The starting square address (format: [R]ow [C]olumn) of the piece 93 | */ 94 | addPiece : function(type, start) { 95 | var newPiece = null; 96 | 97 | if (type === 'king') 98 | array = false; 99 | else if (type === 'pawn') 100 | array = this.pawns; 101 | else 102 | array = this.pieces; 103 | 104 | if (type == 'pawn') 105 | newPiece = new pawn(this.color, start); 106 | else if (type == 'bishop') 107 | newPiece = new bishop(this.color, start); 108 | else if (type == 'knight') 109 | newPiece = new knight(this.color, start); 110 | else if (type == 'rook') 111 | newPiece = new rook(this.color, start); 112 | else if (type == 'queen') 113 | newPiece = new queen(this.color, start); 114 | else 115 | this.King = new king(this.color, start); 116 | 117 | if (array) 118 | array.push(newPiece); 119 | } 120 | }; 121 | /*** End of Player() methods ***/ 122 | 123 | /** 124 | * Parent class of pieces and pawns 125 | * @class Represents a chess piece (or pawn) 126 | * @extends Game 127 | * @param {string} color The color (side) of the Piece 128 | * @param {string} start The starting position of the Piece in format [CR] 129 | */ 130 | Piece = function(color, start) { 131 | this.moved = false; 132 | this.protection = false; 133 | this.position = start; 134 | this.color = color; 135 | this.image = (this.color !== undefined) ? $("") : false; 136 | 137 | if (this.image) 138 | $(this.image).attr({ 139 | src : 'images/' + this + '_' + color + '.png', 140 | alt : color + ' ' + this 141 | }).addClass(color).data('piece', this).appendTo("#" + this.position); 142 | }; 143 | 144 | /** 145 | * @extends Piece 146 | */ 147 | Piece.prototype = { 148 | _move : function(destination) { 149 | var occupant = Game.occupied(destination.id), 150 | self = this, 151 | square_check = null, 152 | capturedPiece = null; 153 | 154 | // Store the occupant of the destination square. 155 | $(this.image).appendTo(destination); 156 | 157 | if (occupant) 158 | capturedPiece = occupant; 159 | else if (this.EP) 160 | capturedPiece = this.EP; 161 | 162 | // If a piece is captured, remove the piece 163 | if (capturedPiece) 164 | $(capturedPiece).remove(); 165 | 166 | square_check = Game.check(Game.Players[0].King.position, Game.Players[1], capturedPiece); 167 | 168 | // Check to see if move results in check << B. Fisher 3/07 2030 169 | if (this.type != 'king' && square_check.threat) { 170 | $('.legal').removeClass('legal'); 171 | 172 | // Move it to the place of the piece it's capturing 173 | $(this.image).appendTo('#' + this.position); 174 | 175 | // Capturing would result in check, put the piece back and 'threat' the king's square << B. Fisher 176 | if (capturedPiece) 177 | (capturedPiece.image).appendTo(capturedPiece.position); 178 | 179 | $('#' + this.position).removeClass('selected'); 180 | $('#' + Game.Players[0].King.position).addClass('threat'); 181 | 182 | // Add attack class to any pieces that are threatening the current player's king 183 | $(square_check).each(function() { 184 | $('#' + this.position).addClass('attack'); 185 | }); 186 | 187 | Game.change = false; 188 | } else { 189 | // The move was valid, carry on with the capture 190 | var location = this.position; 191 | this.position = destination.id; 192 | this.moved = true; 193 | 194 | if (capturedPiece) 195 | capturedPiece.capture(); 196 | Game.change = true; 197 | 198 | if (!(this.type == 'rook' && Game.castled)) 199 | Game.logMove(this, location, capturedPiece); 200 | } 201 | }, 202 | 203 | capture : function() { 204 | this.kill(); 205 | $(this.image).remove(); 206 | 207 | // Show captured piece in the prison << B. Fisher 3/11 1640 208 | var cell = $('#prison [rel="' + this.color + ' ' + this.type + '"]'), prisoner = $(cell).find('img'); 209 | 210 | if ($(prisoner).hasClass('hidden')) { 211 | $(prisoner).removeClass('hidden').hide().fadeIn('slow'); 212 | } 213 | 214 | // If the count span is empty, insert '1' and hide it. 215 | // If it already contains a number, add 1 and show it. << B. Fisher <<3/11 1800 216 | var cellCount = $(cell).find('.count')[0], c = null; 217 | if ($(cellCount).html()) { 218 | c = $(cellCount).html(); 219 | c++; 220 | $(cellCount).html(c).fadeIn('slow'); 221 | } else 222 | $(cellCount).html(1).hide(); 223 | return true; 224 | }, 225 | 226 | /** 227 | * Evaluate the owner of the piece. 228 | * @returns [Object] Player 229 | * @author BF 230 | */ 231 | owner : function() { 232 | var player = (Game.Players[0].color === self.color) ? Game.Players[0] : Game.Players[1]; 233 | return player; 234 | }, 235 | 236 | /** 237 | * Remove captured or promoted pieces from their Players piece or pawn array. 238 | * @param piece the piece to be removed 239 | * @param player the piece's player 240 | * @param array the appropriate array 241 | * @param index location of the piece or pawn in the array 242 | * @author BF 243 | */ 244 | kill : function() { 245 | var index, player = this.owner(), array = (this.type == 'pawn') ? player.pawns : player.pieces; 246 | 247 | index = $.inArray(this, array); 248 | 249 | if (index > -1) 250 | array.splice(index, 1); 251 | }, 252 | 253 | /** 254 | * General legal move function for horizontal, vertical and diagonal moves 255 | * @return [Object] .moves : array of square references where this piece can legally move, 256 | * .capture : array of pieces that this piece can legally capture 257 | * @author BF 258 | */ 259 | hvd_legal : function(){ 260 | var path = null, moves = [], capture = []; 261 | 262 | $.each(this.footprint, function(i){ 263 | path = Game.vector(self.position, this, this.color, true); 264 | 265 | // add squares in current vector to legal moves array 266 | moves = legal.moves.concat(Game.vector(self.position, this, self.color, true).list.split(',')); 267 | 268 | // add vulnerable opposing pieces to legal Array 269 | capture.push(path.end); 270 | }); 271 | 272 | return { 273 | moves: Game.arrayStrip(moves), 274 | capture: Game.arrayStrip(capture) 275 | }; 276 | }, 277 | 278 | /** 279 | * @returns {Array} legal.capture Capturable piece objects 280 | * @returns {Array} legal.moves array of square designations where the -child- can legally move. 281 | * @returns {String} legal.moveList legal moves as CSV list. 282 | * @author BF 283 | */ 284 | Legal : function() { 285 | var legal = this._legal; 286 | 287 | legal.moveList = legal.moves.join(','); 288 | 289 | return legal; 290 | }, // === End of Legal() === // 291 | };// === End of Piece prototype methods === // 292 | 293 | /*** Start piece definitions ***/ 294 | 295 | /** 296 | * @author BF 297 | * @constructor 298 | * @member Piece.prototype 299 | * @param {string} color The pawn's color 300 | * @param {string} start Starting square of the pawn in format [CR] 301 | */ 302 | function pawn(color, start) { 303 | Piece.call(this, color, start); 304 | 305 | this.type = "pawn"; 306 | this.EP = false; 307 | 308 | /** indicates which direction is forward depending on color. */ 309 | this.inc = (color == 'white') ? 1 : -1; 310 | this.promotion = null; 311 | this.logCell = null; 312 | 313 | /** the promotion rank for the pawn */ 314 | this.endRow = (color == 'white') ? 8 : 1; 315 | } 316 | 317 | 318 | pawn.prototype = new Piece(); 319 | 320 | pawn.prototype.toString = function() { 321 | return 'pawn'; 322 | }; 323 | 324 | pawn.prototype.footprint = function() { 325 | self = this; 326 | 327 | var row = self.position[1] * 1, 328 | col = self.position[0], 329 | ids = []; 330 | 331 | if (!self.moved){ ids.push(col + (row + 2 * this.inc)); } 332 | else{ 333 | ids.push(col + (row + 1 * this.inc)); 334 | ids.push(Game.cLabels[Game.colNumber(col) - 1] + (row + this.inc)); 335 | ids.push(Game.cLabels[Game.colNumber(col) + 1] + (row + this.inc)); 336 | }; 337 | return ids; 338 | }; 339 | 340 | pawn.prototype._legal = function(){ 341 | var fp = this.footprint(), 342 | dest = null, 343 | myMoves = [], 344 | myCapture = [], 345 | self = this, 346 | C = self.position[0]; 347 | 348 | $.each(fp, function(i){ 349 | // pawns cannot capture on their own column 350 | dest = Game.occupied('#' + this); 351 | 352 | if (dest && C != this[0]) { 353 | if (dest.color == self.color) myCapture.push(dest); 354 | else myMoves.push(Game.writeID(this[0], this[1])); 355 | } 356 | // Check for a pawn in EP and whether its column matches the move 357 | else if (self.EP && self.EP.position[0] == this[0]) { 358 | myMoves.push(Game.writeID(this[0], this[1])); 359 | } 360 | // add vertical moves 361 | else if (C === this[0]) { 362 | myMoves = myMoves.concat(Game.vector(self.position, this, self.color).list.split(',')); 363 | } 364 | }); 365 | 366 | return{ 367 | moves: myMoves, 368 | capture: myCapture 369 | } 370 | }; 371 | 372 | pawn.prototype.move = function(destination) { 373 | self = this; 374 | var col = this.position[0], row = this.position[1]; 375 | 376 | // Evaluate whether pawn has passed an opponent pawn on opening double step << B. Fisher 377 | if (!this.moved && (destination.id.match(4) || destination.id.match(5))) { 378 | var prev = (col == 'A') ? false : Game.occupied(destination.previousElementSibling.id); 379 | var next = (col == 'H') ? false : Game.occupied(destination.nextElementSibling.id); 380 | if (prev && prev == 'pawn' && prev.color != self.color) 381 | prev.EP = this; 382 | if (next && next == 'pawn' && next.color != self.color) 383 | next.EP = this; 384 | } 385 | // Check if pawn is capturing en passant. EP variable will hold an opponent pawn that passed. 386 | // If opponent pawn and this pawn are not on the same column (position[0]) clear EP variable. << B. Fisher 387 | if (this.EP && this.EP.position[0] != destination.id[0]) 388 | this.EP = false; 389 | 390 | this._move.call(this, destination); 391 | 392 | if (this.position[1] == this.endRow) 393 | this.promote(destination); 394 | }; 395 | 396 | /** 397 | * Pawn promotion functionality 398 | * @method pawn.prototype 399 | * @author BF 400 | * @since 3/06/10 401 | */ 402 | pawn.prototype.promote = function(destination) { 403 | self = this; 404 | bench = $('
'); 405 | logCell = self.logCell; 406 | 407 | bench.attr('id', 'bench'); 408 | 409 | $('

').html('Select a piece for promotion: ').appendTo(bench); 410 | $('').attr('src', 'images/thumb/knight_' + this.color + '_thumb.png').attr('rel', 'knight').appendTo(bench); 411 | $('').attr('src', 'images/thumb/queen_' + this.color + '_thumb.png').attr('rel', 'queen').appendTo(bench); 412 | 413 | bench.appendTo(Game.$cover); 414 | Game.$cover.fadeIn(); 415 | 416 | // Place the promotion piece, add it to the pieces array and append the promotion 417 | // to the logged move. << B. Fisher 3/29 1630 418 | $(bench).children('img').click(function() { 419 | $(this).fadeTo('slow', 0.6).fadeTo('fast', 1).delay(1000); 420 | 421 | if ($(this).attr('rel') == 'queen') { 422 | self.owner().addPiece('queen', destination.id); 423 | $(logCell).html($(logCell).html() + '=Q'); 424 | } else { 425 | self.owner().addPiece('knight', destination.id); 426 | $(logCell).html($(logCell).html() + '=N'); 427 | } 428 | 429 | Game.$cover.children().remove(); 430 | Game.$cover.fadeOut(); 431 | Game.turn(); 432 | }); 433 | 434 | // Remove the pawn's image, and clear it from the Player's pieces array. 435 | $(self.image).remove(); 436 | Game.clearClass(); 437 | // Hold turn change. will be called after a new piece is selected. 438 | Game.change = false; 439 | self.kill(); 440 | }; 441 | 442 | /** 443 | * @author BF 444 | * @constructor 445 | * @member Piece.prototype 446 | */ 447 | function rook(color, start) { 448 | Piece.call(this, color, start); 449 | this.type = "rook"; 450 | } 451 | 452 | 453 | rook.prototype = new Piece(); 454 | 455 | rook.prototype.toString = function() { 456 | return 'rook'; 457 | }; 458 | 459 | rook.prototype.move = function(destination) { 460 | this._move(destination); 461 | }; 462 | 463 | rook.prototype.footprint = function() { 464 | var row = this.position[1], col = this.position[0]; 465 | 466 | return ['A' + row, 'H' + row, col + 1, col + 8]; 467 | }; 468 | 469 | rook.prototype._legal = function(){ 470 | return this.hvd_legal(); 471 | }; 472 | 473 | /** 474 | * @author BF 475 | * @constructor 476 | * @member Piece.prototype 477 | */ 478 | function knight(color, start) { 479 | Piece.call(this, color, start); 480 | this.type = "knight"; 481 | } 482 | 483 | knight.prototype = new Piece(); 484 | 485 | knight.prototype.toString = function() { 486 | return 'knight'; 487 | }; 488 | 489 | knight.prototype.move = function(destination) { 490 | this._move(destination); 491 | }; 492 | 493 | knight.prototype._legal = function(){ 494 | var fp = this.footprint(), 495 | moves = fp.map(function(square){ 496 | if(!Game.occupied('#' + square)) return square; 497 | }), 498 | capture = fp.map(function(square){ 499 | var dest = Game.occupied('#' + square); 500 | if(dest && (dest.color !== this.color)) return dest; 501 | }, this); 502 | 503 | return { 504 | moves: Game.arrayStrip(moves), 505 | capture: Game.arrayStrip(capture) 506 | }; 507 | }; 508 | 509 | knight.prototype.footprint = function() { 510 | var ids = [], 511 | col = Game.colNumber(this.position[0]), 512 | row = this.position[1] * 1, 513 | cShift = null; 514 | 515 | for (var r = row - 2; r <= row + 2; r++) { 516 | if (r != row && r > 0 && r <= 8) { 517 | cShift = (Math.abs(row - r) === 1) ? cShift = 2 : cShift = 1; 518 | if(col + cShift < 8) ids.push(Game.cLabels[col + cShift] + r); 519 | if(col - cShift >= 0) ids.push(Game.cLabels[col - cShift] + r); 520 | } 521 | } 522 | return ids; 523 | }; 524 | 525 | /** 526 | * @author BF 527 | * @constructor 528 | * @member Piece.prototype 529 | */ 530 | function bishop(color, start) { 531 | Piece.call(this, color, start); 532 | 533 | this.type = "bishop"; 534 | }; 535 | 536 | bishop.prototype = new Piece(); 537 | 538 | bishop.prototype.toString = function() { 539 | return 'bishop'; 540 | }; 541 | 542 | bishop.prototype.move = function(destination) { 543 | this._move(destination); 544 | }; 545 | 546 | bishop.prototype.footprint = function() { 547 | return [ 548 | Game.findDiagonal(this.position, 1, 1), 549 | Game.findDiagonal(this.position, 1, -1), 550 | Game.findDiagonal(this.position, -1, 1), 551 | Game.findDiagonal(this.position, -1, -1) 552 | ]; 553 | }; 554 | 555 | bishop.prototype._legal = function(){ 556 | return this.hvd_legal(); 557 | }; 558 | 559 | /** 560 | * @author BF 561 | * @constructor 562 | * @member Piece.prototype 563 | */ 564 | function queen(color, start) { 565 | Piece.call(this, color, start); 566 | this.type = "queen"; 567 | }; 568 | 569 | queen.prototype = new Piece(); 570 | 571 | queen.prototype.toString = function() { 572 | return 'queen'; 573 | }; 574 | 575 | queen.prototype.move = function(destination) { 576 | this._move(destination); 577 | }; 578 | 579 | queen.prototype.footprint = function() { 580 | var row = this.position[1], col = this.position[0]; 581 | return ['A' + row, 'H' + row, col + 1, col + 8, Game.findDiagonal(this.position, 1, 1), Game.findDiagonal(this.position, 1, -1), Game.findDiagonal(this.position, -1, 1), Game.findDiagonal(this.position, -1, -1)]; 582 | }; 583 | 584 | queen.prototype._legal = function(){ 585 | return this.hvd_legal(); 586 | }; 587 | 588 | /** 589 | * @author BF 590 | * @constructor 591 | * @member Piece.prototype 592 | */ 593 | function king(color, start) { 594 | Piece.call(this, color, start); 595 | 596 | this.type = "king"; 597 | this.inCheck = false; 598 | }; 599 | 600 | 601 | king.prototype = new Piece(); 602 | 603 | king.prototype.toString = function() { 604 | return 'king'; 605 | }; 606 | 607 | king.prototype.move = function(destination) { 608 | var rook = null, dest = null; 609 | 610 | // Evaluate if king is castling. << B. Fisher 611 | if (this.castle() && (destination.id.match('G') || destination.id.match('C'))) { 612 | 613 | // If king is moving to column 'G' (kingside) rook is on column 'H' 614 | if (destination.id.match('G')) { 615 | rook = Game.occupied('H' + this.position[1]); 616 | dest = destination.previousElementSibling; 617 | Game.castled = "king"; 618 | } 619 | 620 | // If king is moving to column 'C' (queenside) rook is on column 'A' 621 | else if (destination.id.match('C')) { 622 | rook = Game.occupied('A' + this.position[1]); 623 | dest = destination.nextElementSibling; 624 | Game.castled = "queen"; 625 | } 626 | // Move the king, than move the rook to the king's other side (dest). << B. Fisher 627 | this._move(destination); 628 | $(rook.image).fadeOut('fast', function() { 629 | rook.move(dest); 630 | $(rook.image).fadeIn('fast'); 631 | 632 | // Reset the castled flag to false so black's moves will be logged << J-M Glenn 633 | Game.castled = null; 634 | }); 635 | } else 636 | this._move(destination); 637 | }; 638 | 639 | king.prototype.castle = function() { 640 | if (this.inCheck || this.moved) 641 | return false; 642 | else 643 | return true; 644 | }; 645 | 646 | king.prototype.footprint = function() { 647 | var row = this.position[1] * 1, column = Game.colNumber(this.position[0]), square, squares = new Array(); 648 | 649 | for (var c = column - 1; c <= column + 1; c++) { 650 | for (var r = row - 1; r <= row + 1; r++) { 651 | square = Game.cLabels[c] + r; 652 | if (square != this.position) 653 | squares.push(square); 654 | }; 655 | }; 656 | return squares; 657 | }; 658 | 659 | king.prototype._legal = function(){ 660 | // Check for castle legality and add king double step if true. << B. Fisher 661 | if (self.castle()) { 662 | rook = Game.occupied(Game.writeID('H', rNum)); 663 | 664 | // Kingside castle squares are unoccupied and unthreatened, 665 | // and the kingside rook has not moved. 666 | if (Game.vector(self.position, 'G' + rNum, self.color).list.match('G') && 667 | rook && !rook.moved && 668 | !Game.check('F' + rNum, Game.Players[1]).threat && 669 | !Game.check('G' + rNum, Game.Players[1]).threat) { 670 | legal.moves.push(Game.writeID('G', rNum)); 671 | }; 672 | 673 | // Queenside squares between rook and king are not occupied. 674 | // The king is not moving across check. 675 | // and the queenside rook has not moved. 676 | rook = Game.occupied('#A' + rNum); 677 | if (Game.vector(self.position, 'B' + rNum, self.color).list.match('B') && 678 | rook && !rook.moved && 679 | !Game.check('D' + rNum, Game.Players[1]).threat && 680 | !Game.check('E' + rNum, Game.Players[1]).threat) { 681 | legal.moves.push(Game.writeID('C', rNum)); 682 | }; 683 | } // End Castle legality checks 684 | 685 | // Removes any square ids from legal.moves that would move the king into check << B. Fisher 3.04 1700 686 | $.each(legal.moves, function(index) { 687 | kid = Game.occupied(this); 688 | square_check = Game.check(this, Game.Players[1]); 689 | 690 | // if square is occupied by a piece of opposing color, check for protection 691 | // if protected add .threat class and remove location from legal moves 692 | if (kid.color == Game.Players[1].color) { 693 | if (square_check.protect) { 694 | $(this).addClass('threat'); 695 | } 696 | }; 697 | 698 | // if square is threatened by an opposing piece add .threat class 699 | if (square_check.threat) { 700 | $(this).addClass('threat'); 701 | } 702 | 703 | if (kid && (kid.type === 'bishop' || kid.type === 'rook' || kid.type === 'queen')) { 704 | self.penetration('#' + self.position, kid); 705 | } 706 | for (var s in square_check) 707 | if (square_check[s].type) { 708 | self.penetration(this, square_check[s]); 709 | } 710 | }); 711 | 712 | // Remove threatened squares discovered by penetration from legal list 713 | $('.threat').each(function() { 714 | squares.splice(squares.indexOf('#' + this.id), 1); 715 | }); 716 | } 717 | // End piece definitions 718 | 719 | self.init(); 720 | return false; 721 | }; 722 | 723 | Game.prototype = { 724 | init : function() { 725 | var names = this.get_player_names(); 726 | 727 | $('button').button(); 728 | 729 | Game.Players.push(new Player()); 730 | Game.Players.push(new Player()); 731 | Game.Players[0].activate(); 732 | 733 | $('#turn').html(Game.Players[0].name); 734 | }, 735 | 736 | get_player_names : function() { 737 | Game.$cover.fadeIn(); 738 | 739 | // Create the starting player form 740 | var form = $('

') 741 | .append($('

').html('Welcome to Web Chess')) 742 | .append($('

').html("Enter player's names")) 743 | .append($('
') 744 | .append($('