Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
  <title>Proofathon Question 2 Combinatorics</title>
<style>
table
{padding:none;
border-collapse:collapse;
}
table, td
{padding:none;
border: 1px solid black;
}
td
{padding:0;margin:0;
height:22px;width:22px
}
  span{margin:10px;padding:2px;border:1px dashed;}
div
{margin:0;padding:0;background:red ;width :14px;height :14px;border: 3px solid blue;  }
.vu
{margin-top:3px;margin-left:1px;border-bottom: none }
.vm
{ margin-left:1px;border-bottom: none;border-top: none;height:100%}
.vd
{border-top: 0 ; margin-left:1px;margin-bottom:3px;margin-top:0px;}
.hl
{ border-right: none;margin-top:1px;margin-left:3px;margin-right:0px; }
.hm
{ margin-top:1px;border-left: none;border-right: none;width:100%}
.hr
{margin-top:1px; margin-left:0;border-left: none }
</style>
<script>
var cur,control=0,aplay;
function gei(id)
{return document.getElementById(id);}
function rec(x)
{
  if(cur=='') return;
if(cur=='t') x=gei('toxt').value;
if(cur=='fix') x='';
//gei('log').value+=cur+'("'+x+'");\nu'+cur+'("'+x+'");\n';
var list = gei('log');
var entry = document.createElement('li');
entry.appendChild(document.createTextNode(cur+'("'+x+'");'));
list.appendChild(entry);
if(cur=='hi'){
var entry = document.createElement('li');
entry.appendChild(document.createTextNode('u'+cur+'("'+x+'");'));
list.appendChild(entry);}
init();
end();}
function hb(x)
{gei(x).style.background='black';}
function init(){
var table = gei("tab");gei("tab").innerHTML='';
table.innerHTML='';
for(var r=1;r<=11;r++)
{var row = table.insertRow(r-1);
for(var c=23;c>0;c--) {
var cell = row.insertCell(0);
cell.id='r'+r+'c'+c;
}}
var all=document.getElementsByTagName("td");
for(var a=0;a<all.length;a++) {all[a].onclick=function() {rec(this.id)}}
hb('r4c5'); hb('r4c6'); hb('r4c7'); hb('r5c7'); hb('r6c7'); hb('r6c6'); hb('r6c5'); hb('r7c5'); hb('r8c5'); hb('r8c6'); hb('r8c7'); hb('r4c9'); hb('r5c9'); hb('r6c9'); hb('r7c9'); hb('r8c9'); hb('r8c10'); hb('r8c11'); hb('r7c11'); hb('r6c11'); hb('r5c11'); hb('r4c11'); hb('r4c10'); hb('r4c13'); hb('r4c14'); hb('r5c14'); hb('r6c14'); hb('r7c14'); hb('r8c13'); hb('r8c14'); hb('r8c15'); hb('r4c17'); hb('r5c17'); hb('r6c17'); hb('r6c18'); hb('r6c19'); hb('r5c19'); hb('r4c19'); hb('r7c19'); hb('r8c19');}
function next()
{str=gei('log').getElementsByTagName("li");
if(control>=1) str[control-1].style.background='white';
eval(str[control].innerHTML);
str[control].style.background='yellow';control++;}
function end()
{str=gei('log').getElementsByTagName("li");
for(var x=0;x<str.length;x++){
eval(str[x].innerHTML);
}control=str.length;}
function jump(y)
{str=gei('log').getElementsByTagName("li");
for(var x=0;x<y;x++){
eval(str[x].innerHTML);
}control=y;
str[control-1].style.background='yellow';
str[control].style.background='white';}
cur='hi';
function hi(x) {gei(x).style.background='red';}
function uhi(x) {gei(x).style.background='white';}
function gc(x)
{x=x.split(/r|c/);return [parseInt(x[1]),parseInt(x[2])];}
function mc(r,c){return 'r'+r+'c'+c;}
function v(x) {var span=document.createElement('div');span.className='vu';gei(x).appendChild(span);
y=gc(x);
x=mc(y[0]+1,y[1]);var span=document.createElement('div');span.className='vm';gei(x).appendChild(span);
x=mc(y[0]+2,y[1]);var span=document.createElement('div');span.className='vd';gei(x).appendChild(span);}
function h(x) {
var span=document.createElement('div');span.className='hl';gei(x).appendChild(span);
y=gc(x);
x=mc(y[0],y[1]+1);var span=document.createElement('div');span.className='hm';gei(x).appendChild(span);
x=mc(y[0],y[1]+2);var span=document.createElement('div');span.className='hr';gei(x).appendChild(span);}
function t(x) {gei('txt').innerHTML=x;}
function rem()
{str=gei('log').getElementsByTagName("li");gei('text').value='';
for(var x=0;x<str.length;x++){
gei('text').value+=str[x].innerHTML+'\n';
}}
function dotxt()
{init();
var txt=gei('text').value.split('\n');
var list = gei('log');
for(var a=0;a<txt.length;a++){
var entry = document.createElement('li');
entry.appendChild(document.createTextNode(txt[a]));
entry.id=a;
entry.onclick=function(){jump(this.id);};
list.appendChild(entry);}}
function fix()
{init();v("r5c10");
v("r3c18");
h("r5c4");
v("r5c13");
h("r7c6");
v("r8c8");
 v("r4c8");
}
</script>
</head>
<body onload="cur='';init();dotxt();">
<table id='tab'>
</table><br><span id='txt'>Read the text displyed here.</span><br><hr>
<br>Control:
<button onclick='next();'>Next</button>
<button onclick='init();jump(control-1);'>Previous</button>
<button onclick='end();'>Goto End</button><br>
Autoplay : 
<button onclick='aplay=setInterval(next,1000)'>Start</button>
<button onclick='clearInterval(aplay)'>Stop</button><hr>
<ul id='log' ></ul>
<hr>
<button onclick='cur="v";'>v</button>
<button onclick='cur="h";'>h</button>
<button onclick='cur="hi";'>hi</button>
<button onclick='cur="fix";rec();'>fix</button><br>
<textarea id='toxt'></textarea>
<button onclick='cur="t";rec();'>text</button>
<textarea id='text'>
t("Highlighting Fixed Parts");
v("r5c10");
v("r3c18");
h("r5c4");
v("r5c13");
h("r7c6");
v("r8c8");
v("r4c8");
hi("r3c17");
uhi("r3c17");
t("2 cases&lt;br&gt;As only a vertical or horizontal can pass through it and in 1 way each");
t("2 cases&lt;br&gt;As only a vertical or horizontal can pass through it and in 1 way each");
t("2 cases&lt;br&gt;As only a vertical or horizontal can pass through it and in 1 way each");
t("2 cases&lt;br&gt;As only a vertical or horizontal can pass through it and in 1 way each");
t("2 cases&lt;br&gt;As only a vertical or horizontal can pass through it and in 1 way each");
t("Case 1: Vertical");
v("r1c17");
hi("r1c18");
uhi("r1c18");
hi("r2c18");
uhi("r2c18");
h("r1c18");
h("r2c18");
hi("r3c19");
uhi("r3c19");
h("r3c19");
hi("r1c21");
uhi("r1c21");
hi("r2c21");
uhi("r2c21");
h("r1c21");
h("r2c21");
hi("r3c22");
uhi("r3c22");
hi("r3c23");
uhi("r3c23");
v("r3c22");
v("r3c23");
hi("r4c20");
uhi("r4c20");
hi("r4c21");
uhi("r4c21");
v("r4c20");
v("r4c21");
v("r6c22");
v("r6c23");
v("r7c20");
v("r7c21");
v("r9c22");
v("r9c23");
hi("r10c21");
uhi("r10c21");
hi("r11c21");
uhi("r11c21");
h("r10c19");
h("r11c19");
hi("r9c19");
uhi("r9c19");
h("r9c17");
h("r10c16");
h("r11c16");
hi("r8c18");
uhi("r8c18");
hi("r7c18");
uhi("r7c18");
h("r7c16");
h("r8c16");
hi("r9c16");
uhi("r9c16");
h("r9c14");
h("r10c13");
h("r11c13");
hi("r9c13");
uhi("r9c13");
h("r9c11");
h("r10c10");
h("r11c10");
hi("r9c9");
uhi("r9c9");
v("r9c9");
hi("r9c10");
uhi("r9c10");
t("Case 1: Vertical&lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
t("Case 1: Vertical&lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
t("Case 1: Vertical&lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
t("Case 1: Vertical&lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
t("Case 1: Vertical&lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
fix("");
t("Case 2:Horizontal");
h("r3c15");
hi("r4c15");
uhi("r4c15");
hi("r4c16");
uhi("r4c16");
v("r4c15");
v("r4c16");
hi("r7c15");
uhi("r7c15");
h("r7c15");
hi("r7c18");
uhi("r7c18");
v("r7c18");
hi("r8c16");
uhi("r8c16");
hi("r8c17");
uhi("r8c17");
v("r8c16");
v("r8c17");
hi("r10c18");
uhi("r10c18");
h("r10c18");
hi("r9c19");
uhi("r9c19");
h("r9c19");
h("r10c21");
hi("r9c22");
uhi("r9c22");
hi("r9c23");
uhi("r9c23");
v("r7c22");
v("r7c23");
hi("r8c20");
uhi("r8c20");
hi("r8c21");
uhi("r8c21");
v("r6c20");
v("r6c21");
v("r4c22");
v("r4c23");
v("r3c20");
v("r3c21");
v("r1c22");
v("r1c23");
hi("r1c21");
uhi("r1c21");
hi("r2c21");
uhi("r2c21");
h("r1c19");
h("r2c19");
hi("r3c19");
uhi("r3c19");
t("Case 2:Horizontal &lt;br&gt;Thus 1 box was orphaned and so this case is impossible.");
</textarea>
<button onclick='rem();'>rem</button>
<button onclick='dotxt();'>dotxt</button>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
meghprkhpro
0viewers