curedly flipped octo frontend

This commit is contained in:
Anton Dyudin 2015-05-15 17:22:59 -07:00
parent 17df698c70
commit 2c9828637d
3 changed files with 11 additions and 10 deletions

View File

@ -7,7 +7,7 @@
;head
;meta(charset "utf-8");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js");
;script(type "text/javascript", src "/~/at/base/lib/urb.js");
;link(type "text/css", rel "stylesheet", href "/home/pub/octo/src/main.css");
;title: urbit cit cat eot
==

View File

@ -37,23 +37,23 @@
.spac[data-index="0-0"],
.spac[data-index="1-0"],
.spac[data-index="2-0"] {
border-top: 0;
border-left: 0;
}
.spac[data-index="0-0"],
.spac[data-index="0-1"],
.spac[data-index="0-2"] {
border-left: 0;
border-top: 0;
}
.spac[data-index="2-0"],
.spac[data-index="2-1"],
.spac[data-index="2-2"] {
border-right: 0;
border-bottom: 0;
}
.spac[data-index="0-2"],
.spac[data-index="1-2"],
.spac[data-index="2-2"] {
border-bottom: 0;
}
border-right: 0;
}

View File

@ -4,15 +4,16 @@ $(function() {
symb = [" ","✕","◯"]
draw = function(state) {
space = function(_state,x,y) {
return "<div class='spac' data-index='"+x+"-"+y+
space = function(_state,y,x) {
return "<div class='spac' data-index='"+y+"-"+x+
"'>"+symb[_state]+"</div>"
}
s = ""
x = 0
y = 0
for(i=0;i<9;i++) {
s += space((state.box[i] ? 1 : 0)+(state.boo[i] ? 2 : 0),x,y)
j = [0,3,6,1,4,7,2,5,8][i] // XX math
s += space((state.box[j] ? 1 : 0)+(state.boo[j] ? 2 : 0),y,x)
x++
if((i+1)%3 == 0) {
y++
@ -41,4 +42,4 @@ $(function() {
function(i) { return Number(i); })
urb.send({mark:'octo-move',data:data})
})
})
})