Permalink
Browse files

7x7 board, shrinkToFit:false for problem mode, other problem mode fixes

  • Loading branch information...
jkk committed Sep 12, 2008
1 parent ee0aa05 commit bc9c23d996c5e8a670a053ef8f4aca4b9b4bac5c
View
@@ -3,9 +3,7 @@
<html>
<head>
<title>EidoGo Problem Example</title>
<script type="text/javascript" src="player/js/all.compressed.js"></script>
</head>
<body>
@@ -18,6 +16,12 @@ <h1>EidoGo Player Problem Example</h1>
;W[ih];B[kk];W[hi];B[ij];W[hk])
</div>
<p>Non-shrinking problem on 7x7</p>
<div class="eidogo-player-problem" shrink="no">
(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2]RU[Japanese]SZ[7]KM[0.00]
AW[ab][ac])
</div>
<p>Another problem:</p>
<div class="eidogo-player-problem" sgf="sgf/problem2.sgf"></div>
View
@@ -438,6 +438,13 @@
.eidogo-player .board-gutter.with-coords {
background: #654 url(../images/board-bg-coords.png) no-repeat 5px 5px;
}
.eidogo-player .board.size7 {
position: absolute;
width: 143px;
height: 143px;
background: #888 url(../images/board-7.gif);
margin: 114px 114px;
}
.eidogo-player .board.size9 {
position: absolute;
width: 181px;
@@ -934,8 +941,12 @@
min-height: 50px;
background: #555;
}
.eidogo-player.theme-problem .board.size19 {
background-image: url(../images/board-19-simple.gif) !important;
.eidogo-player.theme-problem .board-gutter {
padding: 0;
}
.eidogo-player.theme-problem .board.size7, .eidogo-player.theme-problem .board.size9,
.eidogo-player.theme-problem .board.size13 {
margin: 0;
}
.eidogo-player.theme-problem .controls-container {
float: none;
View
BIN +886 Bytes player/images/board-7.gif
Binary file not shown.
@@ -1010,8 +1010,8 @@ return [x,y,_3b[0],_3b[1]];
},crop:function(_41){
eidogo.util.addClass(this.domContainer,"shrunk");
this.domGutter.style.overflow="hidden";
var _42=_41.width*this.pointWidth+this.margin;
var _43=_41.height*this.pointHeight+this.margin;
var _42=_41.width*this.pointWidth+(this.margin*2);
var _43=_41.height*this.pointHeight+(this.margin*2);
this.domGutter.style.width=_42+"px";
this.domGutter.style.height=_43+"px";
this.player.dom.player.style.width=_42+"px";
@@ -1272,7 +1272,7 @@ this.searching=false;
this.editingText=false;
this.goingBack=false;
this.problemMode=cfg.problemMode;
this.problemColor=cfg.problemColor||"W";
this.problemColor=cfg.problemColor||"B";
this.prefs={};
this.prefs.markCurrent=typeof cfg.markCurrent!="undefined"?!!cfg.markCurrent:true;
this.prefs.markNext=typeof cfg.markNext!="undefined"?cfg.markNext:false;
@@ -1316,7 +1316,7 @@ this.progressiveUrl=cfg.progressiveUrl||cfg.sgfUrl.replace(/\?.+$/,"");
}
}else{
var _19=cfg.boardSize||"19";
var _1a={19:6.5,13:4.5,9:3.5};
var _1a={19:6.5,13:4.5,9:3.5,7:2.5};
var _1b={_children:[{SZ:_19,KM:cfg.komi||_1a[_19]||6.5,_children:[]}]};
if(cfg.opponentUrl){
this.gameName="gnugo";
@@ -1411,11 +1411,15 @@ _3("get",url,null,_27,_2c,this,30000);
_2e=_2e||{};
this.handleDisplayPrefs();
var _2f=_2e.SZ||19;
if(_2f!=9&&_2f!=13&&_2f!=19){
if(_2f!=7&&_2f!=9&&_2f!=13&&_2f!=19){
_2f=19;
}
if(this.shrinkToFit){
this.calcShrinkToFit(_2e,_2f);
}else{
if(this.problemMode&&!this.cropParams){
this.cropParams={width:_2f,height:_2f,top:0,left:0,padding:1};
}
}
if(!this.board){
this.createBoard(_2f);
@@ -3115,10 +3119,14 @@ if(el.innerHTML){
_a.sgf=el.innerHTML;
}
}
var _d=el.getAttribute("shrink");
if(_d){
_a.shrinkToFit=(_d=="no"?false:true);
}
el.innerHTML="";
eidogo.util.show(el);
var _d=new eidogo.Player(_a);
eidogo.autoPlayers.push(_d);
var _e=new eidogo.Player(_a);
eidogo.autoPlayers.push(_e);
}
});
})();
View
@@ -349,8 +349,8 @@ eidogo.BoardRendererHtml.prototype = {
crop: function(crop) {
eidogo.util.addClass(this.domContainer, "shrunk");
this.domGutter.style.overflow = "hidden";
var width = crop.width * this.pointWidth + this.margin;
var height = crop.height * this.pointHeight + this.margin;
var width = crop.width * this.pointWidth + (this.margin * 2);
var height = crop.height * this.pointHeight + (this.margin * 2);
this.domGutter.style.width = width + "px";
this.domGutter.style.height = height + "px";
this.player.dom.player.style.width = width + "px";
View
@@ -51,9 +51,13 @@
for (var key in autoCfg)
cfg[key] = autoCfg[key];
var sgfUrl = el.getAttribute('sgf');
if (sgfUrl) cfg.sgfUrl = sgfUrl;
else if (el.innerHTML) cfg.sgf = el.innerHTML;
if (sgfUrl)
cfg.sgfUrl = sgfUrl;
else if (el.innerHTML)
cfg.sgf = el.innerHTML;
var shrink = el.getAttribute('shrink');
if (shrink)
cfg.shrinkToFit = (shrink == "no" ? false : true);
el.innerHTML = "";
eidogo.util.show(el);
View
@@ -291,7 +291,7 @@ eidogo.Player.prototype = {
// problem-solving mode: respond when the user plays a move
this.problemMode = cfg.problemMode;
this.problemColor = cfg.problemColor || "W";
this.problemColor = cfg.problemColor || "B";
// user-changeable preferences
this.prefs = {};
@@ -373,7 +373,7 @@ eidogo.Player.prototype = {
// start from scratch
var boardSize = cfg.boardSize || "19";
var komiMap = {19: 6.5, 13: 4.5, 9: 3.5};
var komiMap = {19: 6.5, 13: 4.5, 9: 3.5, 7: 2.5};
var blankGame = {_children: [{
SZ: boardSize,
KM: cfg.komi || komiMap[boardSize] || 6.5,
@@ -532,9 +532,18 @@ eidogo.Player.prototype = {
this.handleDisplayPrefs();
var size = gameRoot.SZ || 19;
// Only three sizes supported for now
if (size != 9 && size != 13 && size != 19)
if (size != 7 && size != 9 && size != 13 && size != 19)
size = 19;
if (this.shrinkToFit) this.calcShrinkToFit(gameRoot, size);
if (this.shrinkToFit)
this.calcShrinkToFit(gameRoot, size);
else if (this.problemMode && !this.cropParams) {
this.cropParams = {
width: size,
height: size,
top: 0,
left: 0,
padding: 1};
}
if (!this.board) {
// first time
this.createBoard(size);
View
@@ -25,6 +25,9 @@ if ($dir && $collections[$dir] && $num) {
} else {
echo "<h2>Go Problems</h2>";
echo "<p>Note: responses are provided for the problems, but they will not
tell you when you get it right. This area of the site is still
being developed.</p>";
echo "<ul>\n";
foreach ($collections as $dir => $title) {
echo "<li><p><a href='/problems/$dir/1'>$title</a></p></li>\n";

0 comments on commit bc9c23d

Please sign in to comment.