Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38563 > unrolled thread

Programming chess, rules

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2020-07-21 01:35 -0700
Last post2020-07-21 09:27 -0700
Articles 14 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 01:35 -0700
    Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 01:45 -0700
    Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 02:07 -0700
      Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 02:09 -0700
    Re: Programming chess, rules Arno Welzel <usenet@arnowelzel.de> - 2020-07-21 11:50 +0200
      Re: Programming chess, rules Arno Welzel <usenet@arnowelzel.de> - 2020-07-21 11:52 +0200
    Re: Programming chess, rules Daniele <webmaster@appliserver.com> - 2020-07-21 14:12 +0200
      Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 08:17 -0700
        Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 09:19 -0700
          Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 10:10 -0700
            Re: Programming chess, rules luserdroog <luser.droog@gmail.com> - 2020-07-21 10:21 -0700
              Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-21 17:25 -0700
                Re: Programming chess, rules Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-22 08:33 -0700
        Re: Programming chess, rules luserdroog <luser.droog@gmail.com> - 2020-07-21 09:27 -0700

#38563 — Programming chess, rules

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 01:35 -0700
SubjectProgramming chess, rules
Message-ID<b14648f1-8f4e-440e-af00-c116e29e7de8o@googlegroups.com>
Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".

But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?

<HTML>
<BODY BGCOLOR=purple>
<B><font size=5 color="white">CHESS | DEEP PURPLE</font></B>
<select name="piececolor" id="piececolor" onChange="chess()">
  <option value="random">random</option>
  <option value="white">white</option>
  <option value="black">black</option>
</select>
<P>
  
</BODY>
</HTML>
<canvas id="myCanvas" width="1500" height="850"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctm = c.getContext("2d");

function colorChoice(){
uplayer="";
var e = document.getElementById("piececolor");
	sel = e.options[e.selectedIndex].text;
if (sel=="random"){random();}
else if(sel=="white") {uplayer="white";}
else if(sel=="black") {uplayer="black";}
}

function random(){
holder = Math.random() < 0.5;
if (holder==true){uplayer="white";} else if (holder==false){uplayer="black";}
}

function chess(){
    ctm.fillStyle = "#383428";
	ctm.fillRect(0, 0, 1500, 850);
	colorChoice();
	board();
	pieceSetup();
}

function board(){
squareColor="#fae0c8";
	fullBoard=64;
	posX=52;
	posY=2;
	row="odd";
	black="#6F5D5D";
	white="#fae0c8";
	var i=0;
	var j=0;
	posX=52;
	posY=2;
	while (i<64) {
	ctm.fillStyle = squareColor;
	ctm.fillRect(posX,posY,98,98);
	posX=posX+100; 
	if(posX>=800){posX=52;posY=posY+100;if(row=="odd"){row="even"; squareColor=white} else{row="odd";squareColor=black; }};
	if(row=="odd"){if(squareColor==white){squareColor=black} else {squareColor=white}}
	if(row=="even"){if(squareColor==black){squareColor=white} else {squareColor=black}}
	i++;
	}
}

function pieceSetup(){
BPieceC="#700000";
WPieceC="#89D1FE";
ctm.font = "96px courier bold";

if (uplayer=="white")
{ctm.fillStyle = WPieceC;ctm.fillText("\u{265B}", 350, 790);ctm.fillText("\u{265A}", 450, 790);} 
else 
{ctm.fillStyle = BPieceC;ctm.fillText("\u{265A}", 350, 790);ctm.fillText("\u{265B}", 450, 790);}

ctm.fillText("\u{265F}", 50, 690);
ctm.fillText("\u{265F}", 150, 690);
ctm.fillText("\u{265F}", 250, 690);
ctm.fillText("\u{265F}", 350, 690);
ctm.fillText("\u{265F}", 450, 690);
ctm.fillText("\u{265F}", 550, 690);
ctm.fillText("\u{265F}", 650, 690);
ctm.fillText("\u{265F}", 750, 690);
ctm.fillText("\u{265C}", 50, 790);
ctm.fillText("\u{265E}", 150, 790);
ctm.fillText("\u{265D}", 250, 790);
ctm.fillText("\u{265D}", 550, 790);
ctm.fillText("\u{265E}", 650, 790);
ctm.fillText("\u{265C}", 750, 790);

if (uplayer=="black")
{ctm.fillStyle = WPieceC;ctm.fillText("\u{265A}", 350, 90);ctm.fillText("\u{265B}", 450, 90);} 
else 
{ctm.fillStyle = BPieceC;ctm.fillText("\u{265B}", 350, 90);ctm.fillText("\u{265A}", 450, 90);}

ctm.fillText("\u{265F}", 50, 190);
ctm.fillText("\u{265F}", 150, 190);
ctm.fillText("\u{265F}", 250, 190);
ctm.fillText("\u{265F}", 350, 190);
ctm.fillText("\u{265F}", 450, 190);
ctm.fillText("\u{265F}", 550, 190);
ctm.fillText("\u{265F}", 650, 190);
ctm.fillText("\u{265F}", 750, 190);
ctm.fillText("\u{265C}", 50, 90);
ctm.fillText("\u{265E}", 150, 90);
ctm.fillText("\u{265D}", 250, 90);
ctm.fillText("\u{265D}", 550, 90);
ctm.fillText("\u{265E}", 650, 90);
ctm.fillText("\u{265C}", 750, 90);

ctm.font = "30px courier bold";
	ctm.fillStyle = "white";
	posY=0;
	for (var j=8;j>0;j--){ ctm.fillText( j, posX-30, posY+60);posY=posY+100; }
	posY=840;posX=90;
	for (var j=0;j<8;j++){ ctm.fillText(  String.fromCharCode(65+j), posX, posY);posX=posX+100; }
}
chess();
</script>

[toc] | [next] | [standalone]


#38564

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 01:45 -0700
Message-ID<86f534c5-b45b-40eb-a279-6fd6241351d7o@googlegroups.com>
In reply to#38563
Den tisdag 21 juli 2020 kl. 10:35:53 UTC+2 skrev Jonas Thörnvall:
> Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> 
> But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> 
> <HTML>
> <BODY BGCOLOR=purple>
> <B><font size=5 color="white">CHESS | DEEP PURPLE</font></B>
> <select name="piececolor" id="piececolor" onChange="chess()">
>   <option value="random">random</option>
>   <option value="white">white</option>
>   <option value="black">black</option>
> </select>
> <P>
>   
> </BODY>
> </HTML>
> <canvas id="myCanvas" width="1500" height="850"></canvas>
> <script>
> var c = document.getElementById("myCanvas");
> var ctm = c.getContext("2d");
> 
> function colorChoice(){
> uplayer="";
> var e = document.getElementById("piececolor");
> 	sel = e.options[e.selectedIndex].text;
> if (sel=="random"){random();}
> else if(sel=="white") {uplayer="white";}
> else if(sel=="black") {uplayer="black";}
> }
> 
> function random(){
> holder = Math.random() < 0.5;
> if (holder==true){uplayer="white";} else if (holder==false){uplayer="black";}
> }
> 
> function chess(){
>     ctm.fillStyle = "#383428";
> 	ctm.fillRect(0, 0, 1500, 850);
> 	colorChoice();
> 	board();
> 	pieceSetup();
> }
> 
> function board(){
> squareColor="#fae0c8";
> 	fullBoard=64;
> 	posX=52;
> 	posY=2;
> 	row="odd";
> 	black="#6F5D5D";
> 	white="#fae0c8";
> 	var i=0;
> 	var j=0;
> 	posX=52;
> 	posY=2;
> 	while (i<64) {
> 	ctm.fillStyle = squareColor;
> 	ctm.fillRect(posX,posY,98,98);
> 	posX=posX+100; 
> 	if(posX>=800){posX=52;posY=posY+100;if(row=="odd"){row="even"; squareColor=white} else{row="odd";squareColor=black; }};
> 	if(row=="odd"){if(squareColor==white){squareColor=black} else {squareColor=white}}
> 	if(row=="even"){if(squareColor==black){squareColor=white} else {squareColor=black}}
> 	i++;
> 	}
> }
> 
> function pieceSetup(){
> BPieceC="#700000";
> WPieceC="#89D1FE";
> ctm.font = "96px courier bold";
> 
> if (uplayer=="white")
> {ctm.fillStyle = WPieceC;ctm.fillText("\u{265B}", 350, 790);ctm.fillText("\u{265A}", 450, 790);} 
> else 
> {ctm.fillStyle = BPieceC;ctm.fillText("\u{265A}", 350, 790);ctm.fillText("\u{265B}", 450, 790);}
> 
> ctm.fillText("\u{265F}", 50, 690);
> ctm.fillText("\u{265F}", 150, 690);
> ctm.fillText("\u{265F}", 250, 690);
> ctm.fillText("\u{265F}", 350, 690);
> ctm.fillText("\u{265F}", 450, 690);
> ctm.fillText("\u{265F}", 550, 690);
> ctm.fillText("\u{265F}", 650, 690);
> ctm.fillText("\u{265F}", 750, 690);
> ctm.fillText("\u{265C}", 50, 790);
> ctm.fillText("\u{265E}", 150, 790);
> ctm.fillText("\u{265D}", 250, 790);
> ctm.fillText("\u{265D}", 550, 790);
> ctm.fillText("\u{265E}", 650, 790);
> ctm.fillText("\u{265C}", 750, 790);
> 
> if (uplayer=="black")
> {ctm.fillStyle = WPieceC;ctm.fillText("\u{265A}", 350, 90);ctm.fillText("\u{265B}", 450, 90);} 
> else 
> {ctm.fillStyle = BPieceC;ctm.fillText("\u{265B}", 350, 90);ctm.fillText("\u{265A}", 450, 90);}
> 
> ctm.fillText("\u{265F}", 50, 190);
> ctm.fillText("\u{265F}", 150, 190);
> ctm.fillText("\u{265F}", 250, 190);
> ctm.fillText("\u{265F}", 350, 190);
> ctm.fillText("\u{265F}", 450, 190);
> ctm.fillText("\u{265F}", 550, 190);
> ctm.fillText("\u{265F}", 650, 190);
> ctm.fillText("\u{265F}", 750, 190);
> ctm.fillText("\u{265C}", 50, 90);
> ctm.fillText("\u{265E}", 150, 90);
> ctm.fillText("\u{265D}", 250, 90);
> ctm.fillText("\u{265D}", 550, 90);
> ctm.fillText("\u{265E}", 650, 90);
> ctm.fillText("\u{265C}", 750, 90);
> 
> ctm.font = "30px courier bold";
> 	ctm.fillStyle = "white";
> 	posY=0;
> 	for (var j=8;j>0;j--){ ctm.fillText( j, posX-30, posY+60);posY=posY+100; }
> 	posY=840;posX=90;
> 	for (var j=0;j<8;j++){ ctm.fillText(  String.fromCharCode(65+j), posX, posY);posX=posX+100; }
> }
> chess();
> </script>

Or maybe the idea of square properties just a waiste of time and you only check for position of pieces, compared to movement?

[toc] | [prev] | [next] | [standalone]


#38565

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 02:07 -0700
Message-ID<623796e5-5b4a-4ed8-a9a4-11030b3d8ecdo@googlegroups.com>
In reply to#38563
Den tisdag 21 juli 2020 kl. 10:35:53 UTC+2 skrev Jonas Thörnvall:
> Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> 
> But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> 
> <HTML>
> <BODY BGCOLOR=purple>
> <B><font size=5 color="white">CHESS | DEEP PURPLE</font></B>
> <select name="piececolor" id="piececolor" onChange="chess()">
>   <option value="random">random</option>
>   <option value="white">white</option>
>   <option value="black">black</option>
> </select>
> <P>
>   
> </BODY>
> </HTML>
> <canvas id="myCanvas" width="1500" height="850"></canvas>
> <script>
> var c = document.getElementById("myCanvas");
> var ctm = c.getContext("2d");
> 
> function colorChoice(){
> uplayer="";
> var e = document.getElementById("piececolor");
> 	sel = e.options[e.selectedIndex].text;
> if (sel=="random"){random();}
> else if(sel=="white") {uplayer="white";}
> else if(sel=="black") {uplayer="black";}
> }
> 
> function random(){
> holder = Math.random() < 0.5;
> if (holder==true){uplayer="white";} else if (holder==false){uplayer="black";}
> }
> 
> function chess(){
>     ctm.fillStyle = "#383428";
> 	ctm.fillRect(0, 0, 1500, 850);
> 	colorChoice();
> 	board();
> 	pieceSetup();
> }
> 
> function board(){
> squareColor="#fae0c8";
> 	fullBoard=64;
> 	posX=52;
> 	posY=2;
> 	row="odd";
> 	black="#6F5D5D";
> 	white="#fae0c8";
> 	var i=0;
> 	var j=0;
> 	posX=52;
> 	posY=2;
> 	while (i<64) {
> 	ctm.fillStyle = squareColor;
> 	ctm.fillRect(posX,posY,98,98);
> 	posX=posX+100; 
> 	if(posX>=800){posX=52;posY=posY+100;if(row=="odd"){row="even"; squareColor=white} else{row="odd";squareColor=black; }};
> 	if(row=="odd"){if(squareColor==white){squareColor=black} else {squareColor=white}}
> 	if(row=="even"){if(squareColor==black){squareColor=white} else {squareColor=black}}
> 	i++;
> 	}
> }
> 
> function pieceSetup(){
> BPieceC="#700000";
> WPieceC="#89D1FE";
> ctm.font = "96px courier bold";
> 
> if (uplayer=="white")
> {ctm.fillStyle = WPieceC;ctm.fillText("\u{265B}", 350, 790);ctm.fillText("\u{265A}", 450, 790);} 
> else 
> {ctm.fillStyle = BPieceC;ctm.fillText("\u{265A}", 350, 790);ctm.fillText("\u{265B}", 450, 790);}
> 
> ctm.fillText("\u{265F}", 50, 690);
> ctm.fillText("\u{265F}", 150, 690);
> ctm.fillText("\u{265F}", 250, 690);
> ctm.fillText("\u{265F}", 350, 690);
> ctm.fillText("\u{265F}", 450, 690);
> ctm.fillText("\u{265F}", 550, 690);
> ctm.fillText("\u{265F}", 650, 690);
> ctm.fillText("\u{265F}", 750, 690);
> ctm.fillText("\u{265C}", 50, 790);
> ctm.fillText("\u{265E}", 150, 790);
> ctm.fillText("\u{265D}", 250, 790);
> ctm.fillText("\u{265D}", 550, 790);
> ctm.fillText("\u{265E}", 650, 790);
> ctm.fillText("\u{265C}", 750, 790);
> 
> if (uplayer=="black")
> {ctm.fillStyle = WPieceC;ctm.fillText("\u{265A}", 350, 90);ctm.fillText("\u{265B}", 450, 90);} 
> else 
> {ctm.fillStyle = BPieceC;ctm.fillText("\u{265B}", 350, 90);ctm.fillText("\u{265A}", 450, 90);}
> 
> ctm.fillText("\u{265F}", 50, 190);
> ctm.fillText("\u{265F}", 150, 190);
> ctm.fillText("\u{265F}", 250, 190);
> ctm.fillText("\u{265F}", 350, 190);
> ctm.fillText("\u{265F}", 450, 190);
> ctm.fillText("\u{265F}", 550, 190);
> ctm.fillText("\u{265F}", 650, 190);
> ctm.fillText("\u{265F}", 750, 190);
> ctm.fillText("\u{265C}", 50, 90);
> ctm.fillText("\u{265E}", 150, 90);
> ctm.fillText("\u{265D}", 250, 90);
> ctm.fillText("\u{265D}", 550, 90);
> ctm.fillText("\u{265E}", 650, 90);
> ctm.fillText("\u{265C}", 750, 90);
> 
> ctm.font = "30px courier bold";
> 	ctm.fillStyle = "white";
> 	posY=0;
> 	for (var j=8;j>0;j--){ ctm.fillText( j, posX-30, posY+60);posY=posY+100; }
> 	posY=840;posX=90;
> 	for (var j=0;j<8;j++){ ctm.fillText(  String.fromCharCode(65+j), posX, posY);posX=posX+100; }
> }
> chess();
> </script>

It seem that empty spaces/squares, or squares in general should somehow be a separate part because how otherwise look forward into the game "planning".

So what do you think is it pieces holding positions or squares holding pieces "properties" or maybe both?

[toc] | [prev] | [next] | [standalone]


#38566

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 02:09 -0700
Message-ID<0c031ada-4223-43ba-9286-b604142e17eco@googlegroups.com>
In reply to#38565
Den tisdag 21 juli 2020 kl. 11:07:20 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 21 juli 2020 kl. 10:35:53 UTC+2 skrev Jonas Thörnvall:
> > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > 
> > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > 
> > <HTML>
> > <BODY BGCOLOR=purple>
> > <B><font size=5 color="white">CHESS | DEEP PURPLE</font></B>
> > <select name="piececolor" id="piececolor" onChange="chess()">
> >   <option value="random">random</option>
> >   <option value="white">white</option>
> >   <option value="black">black</option>
> > </select>
> > <P>
> >   
> > </BODY>
> > </HTML>
> > <canvas id="myCanvas" width="1500" height="850"></canvas>
> > <script>
> > var c = document.getElementById("myCanvas");
> > var ctm = c.getContext("2d");
> > 
> > function colorChoice(){
> > uplayer="";
> > var e = document.getElementById("piececolor");
> > 	sel = e.options[e.selectedIndex].text;
> > if (sel=="random"){random();}
> > else if(sel=="white") {uplayer="white";}
> > else if(sel=="black") {uplayer="black";}
> > }
> > 
> > function random(){
> > holder = Math.random() < 0.5;
> > if (holder==true){uplayer="white";} else if (holder==false){uplayer="black";}
> > }
> > 
> > function chess(){
> >     ctm.fillStyle = "#383428";
> > 	ctm.fillRect(0, 0, 1500, 850);
> > 	colorChoice();
> > 	board();
> > 	pieceSetup();
> > }
> > 
> > function board(){
> > squareColor="#fae0c8";
> > 	fullBoard=64;
> > 	posX=52;
> > 	posY=2;
> > 	row="odd";
> > 	black="#6F5D5D";
> > 	white="#fae0c8";
> > 	var i=0;
> > 	var j=0;
> > 	posX=52;
> > 	posY=2;
> > 	while (i<64) {
> > 	ctm.fillStyle = squareColor;
> > 	ctm.fillRect(posX,posY,98,98);
> > 	posX=posX+100; 
> > 	if(posX>=800){posX=52;posY=posY+100;if(row=="odd"){row="even"; squareColor=white} else{row="odd";squareColor=black; }};
> > 	if(row=="odd"){if(squareColor==white){squareColor=black} else {squareColor=white}}
> > 	if(row=="even"){if(squareColor==black){squareColor=white} else {squareColor=black}}
> > 	i++;
> > 	}
> > }
> > 
> > function pieceSetup(){
> > BPieceC="#700000";
> > WPieceC="#89D1FE";
> > ctm.font = "96px courier bold";
> > 
> > if (uplayer=="white")
> > {ctm.fillStyle = WPieceC;ctm.fillText("\u{265B}", 350, 790);ctm.fillText("\u{265A}", 450, 790);} 
> > else 
> > {ctm.fillStyle = BPieceC;ctm.fillText("\u{265A}", 350, 790);ctm.fillText("\u{265B}", 450, 790);}
> > 
> > ctm.fillText("\u{265F}", 50, 690);
> > ctm.fillText("\u{265F}", 150, 690);
> > ctm.fillText("\u{265F}", 250, 690);
> > ctm.fillText("\u{265F}", 350, 690);
> > ctm.fillText("\u{265F}", 450, 690);
> > ctm.fillText("\u{265F}", 550, 690);
> > ctm.fillText("\u{265F}", 650, 690);
> > ctm.fillText("\u{265F}", 750, 690);
> > ctm.fillText("\u{265C}", 50, 790);
> > ctm.fillText("\u{265E}", 150, 790);
> > ctm.fillText("\u{265D}", 250, 790);
> > ctm.fillText("\u{265D}", 550, 790);
> > ctm.fillText("\u{265E}", 650, 790);
> > ctm.fillText("\u{265C}", 750, 790);
> > 
> > if (uplayer=="black")
> > {ctm.fillStyle = WPieceC;ctm.fillText("\u{265A}", 350, 90);ctm.fillText("\u{265B}", 450, 90);} 
> > else 
> > {ctm.fillStyle = BPieceC;ctm.fillText("\u{265B}", 350, 90);ctm.fillText("\u{265A}", 450, 90);}
> > 
> > ctm.fillText("\u{265F}", 50, 190);
> > ctm.fillText("\u{265F}", 150, 190);
> > ctm.fillText("\u{265F}", 250, 190);
> > ctm.fillText("\u{265F}", 350, 190);
> > ctm.fillText("\u{265F}", 450, 190);
> > ctm.fillText("\u{265F}", 550, 190);
> > ctm.fillText("\u{265F}", 650, 190);
> > ctm.fillText("\u{265F}", 750, 190);
> > ctm.fillText("\u{265C}", 50, 90);
> > ctm.fillText("\u{265E}", 150, 90);
> > ctm.fillText("\u{265D}", 250, 90);
> > ctm.fillText("\u{265D}", 550, 90);
> > ctm.fillText("\u{265E}", 650, 90);
> > ctm.fillText("\u{265C}", 750, 90);
> > 
> > ctm.font = "30px courier bold";
> > 	ctm.fillStyle = "white";
> > 	posY=0;
> > 	for (var j=8;j>0;j--){ ctm.fillText( j, posX-30, posY+60);posY=posY+100; }
> > 	posY=840;posX=90;
> > 	for (var j=0;j<8;j++){ ctm.fillText(  String.fromCharCode(65+j), posX, posY);posX=posX+100; }
> > }
> > chess();
> > </script>
> 
> It seem that empty spaces/squares, or squares in general should somehow be a separate part because how otherwise look forward into the game "planning".
> 
> So what do you think is it pieces holding positions or squares holding pieces "properties" or maybe both?

A saved chess game is just pieces holding positions, but the game itself is about forking possible positions over the board?

[toc] | [prev] | [next] | [standalone]


#38567

FromArno Welzel <usenet@arnowelzel.de>
Date2020-07-21 11:50 +0200
Message-ID<hnns2eFkatjU1@mid.individual.net>
In reply to#38563
Jonas Thörnvall:

> Got a little taste for graphical programming. But it was a long time
> since i did program any sort of game. I think i can see how to
> program the actual piece movement of pieces "except for maybe
> castling and draw, and possibly other specialities".
> 
> But howto treat the squares of board? Is each square just an object
> ID with two properties "occupied/free" "black and white"?
[...]

<https://nanochess.org/chess4.html#js1k>

*scnr*


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#38568

FromArno Welzel <usenet@arnowelzel.de>
Date2020-07-21 11:52 +0200
Message-ID<hnns6oFkatjU2@mid.individual.net>
In reply to#38567
Arno Welzel:

> Jonas Thörnvall:
> 
>> Got a little taste for graphical programming. But it was a long time
>> since i did program any sort of game. I think i can see how to
>> program the actual piece movement of pieces "except for maybe
>> castling and draw, and possibly other specialities".
>>
>> But howto treat the squares of board? Is each square just an object
>> ID with two properties "occupied/free" "black and white"?
> [...]
> 
> <https://nanochess.org/chess4.html#js1k>
> 
> *scnr*

In addition: here is a live playable version of the 1K-chess-script:

<https://js1k.com/2010-first/demo/750>


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#38569

FromDaniele <webmaster@appliserver.com>
Date2020-07-21 14:12 +0200
Message-ID<rf6m43$pbd$1@dont-email.me>
In reply to#38563
Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> 
> But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
Look at www.lutanho.net
I used the stuff from Lutz Tautenhahn to build a chess site and it works 
nicely. First implementation was with chesstempo, but the script is 
large, while the script from Lutz is more manageable.

HTH, Dan

[toc] | [prev] | [next] | [standalone]


#38570

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 08:17 -0700
Message-ID<e0c27325-7111-4b4b-b445-3793776e480do@googlegroups.com>
In reply to#38569
Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > 
> > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> Look at www.lutanho.net
> I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> nicely. First implementation was with chesstempo, but the script is 
> large, while the script from Lutz is more manageable.
> 
> HTH, Dan

I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".

JT

[toc] | [prev] | [next] | [standalone]


#38571

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 09:19 -0700
Message-ID<ea90de3e-732f-4929-a8f5-2e5066f388eao@googlegroups.com>
In reply to#38570
Den tisdag 21 juli 2020 kl. 17:17:13 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> > Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > > 
> > > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > Look at www.lutanho.net
> > I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> > nicely. First implementation was with chesstempo, but the script is 
> > large, while the script from Lutz is more manageable.
> > 
> > HTH, Dan
> 
> I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> 
> JT

I start to rethink my naive approach, mahbe the square ID what is important and what it hold. There is 64 id's that could hold named pieces or be empty.

But then again it seem the ID's do have views that change order of layout of ID's depending if you play whit or black.

Implementing the 64 objects do seem easier then laying them out in two views.

[toc] | [prev] | [next] | [standalone]


#38573

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 10:10 -0700
Message-ID<828b9308-8ba7-455e-b10e-846b6efd1531o@googlegroups.com>
In reply to#38571
Den tisdag 21 juli 2020 kl. 18:19:15 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 21 juli 2020 kl. 17:17:13 UTC+2 skrev Jonas Thörnvall:
> > Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> > > Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > > > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > > > 
> > > > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > > Look at www.lutanho.net
> > > I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> > > nicely. First implementation was with chesstempo, but the script is 
> > > large, while the script from Lutz is more manageable.
> > > 
> > > HTH, Dan
> > 
> > I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> > 
> > JT
> 
> I start to rethink my naive approach, mahbe the square ID what is important and what it hold. There is 64 id's that could hold named pieces or be empty.
> 
> But then again it seem the ID's do have views that change order of layout of ID's depending if you play whit or black.
> 
> Implementing the 64 objects do seem easier then laying them out in two views.

And that of course beg the question do each ID have twp positions, but those ID's positions should probably be encapsulated in different views. But each ID still have different position, so do you set the position at printout?

[toc] | [prev] | [next] | [standalone]


#38574

Fromluserdroog <luser.droog@gmail.com>
Date2020-07-21 10:21 -0700
Message-ID<6a33812d-00fa-42ea-83c9-b6d5a9ed5034o@googlegroups.com>
In reply to#38573
On Tuesday, July 21, 2020 at 12:10:38 PM UTC-5, Jonas Thörnvall wrote:
> Den tisdag 21 juli 2020 kl. 18:19:15 UTC+2 skrev Jonas Thörnvall:
> > Den tisdag 21 juli 2020 kl. 17:17:13 UTC+2 skrev Jonas Thörnvall:
> > > Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> > > > Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > > > > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > > > > 
> > > > > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > > > Look at www.lutanho.net
> > > > I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> > > > nicely. First implementation was with chesstempo, but the script is 
> > > > large, while the script from Lutz is more manageable.
> > > > 
> > > > HTH, Dan
> > > 
> > > I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> > > 
> > > JT
> > 
> > I start to rethink my naive approach, mahbe the square ID what is important and what it hold. There is 64 id's that could hold named pieces or be empty.
> > 
> > But then again it seem the ID's do have views that change order of layout of ID's depending if you play whit or black.
> > 
> > Implementing the 64 objects do seem easier then laying them out in two views.
> 
> And that of course beg the question do each ID have twp positions, but those ID's positions should probably be encapsulated in different views. But each ID still have different position, so do you set the position at printout?

Nit: "begs the question" is a logical fallacy. Prefer "raises the 
question".

If I were designing such a thing, I'd be tempted to leave the html
objects' ids fairly generic. It could be 2D or 1D. 

Internally there would be a 2D array to represent the board which 
is always oriented the same, then the mapping can be changed to have
white or black at the bottom.

If you haven't looked at it yet, I suggest you read about the various
notations for chess moves. It might be a good addition to the UI to
allow the player to type their moves in, and a big bonus to read the 
log of moves in standard notation.

The notation could be very helpful to organize your ideas of how to
represent pieces and moves.

[toc] | [prev] | [next] | [standalone]


#38580

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-21 17:25 -0700
Message-ID<4cd6b1ed-4c45-4f76-bbf5-58685f5a9ac6o@googlegroups.com>
In reply to#38574
Den tisdag 21 juli 2020 kl. 19:21:52 UTC+2 skrev luserdroog:
> On Tuesday, July 21, 2020 at 12:10:38 PM UTC-5, Jonas Thörnvall wrote:
> > Den tisdag 21 juli 2020 kl. 18:19:15 UTC+2 skrev Jonas Thörnvall:
> > > Den tisdag 21 juli 2020 kl. 17:17:13 UTC+2 skrev Jonas Thörnvall:
> > > > Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> > > > > Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > > > > > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > > > > > 
> > > > > > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > > > > Look at www.lutanho.net
> > > > > I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> > > > > nicely. First implementation was with chesstempo, but the script is 
> > > > > large, while the script from Lutz is more manageable.
> > > > > 
> > > > > HTH, Dan
> > > > 
> > > > I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> > > > 
> > > > JT
> > > 
> > > I start to rethink my naive approach, mahbe the square ID what is important and what it hold. There is 64 id's that could hold named pieces or be empty.
> > > 
> > > But then again it seem the ID's do have views that change order of layout of ID's depending if you play whit or black.
> > > 
> > > Implementing the 64 objects do seem easier then laying them out in two views.
> > 
> > And that of course beg the question do each ID have twp positions, but those ID's positions should probably be encapsulated in different views. But each ID still have different position, so do you set the position at printout?
> 
> Nit: "begs the question" is a logical fallacy. Prefer "raises the 
> question".
> 
> If I were designing such a thing, I'd be tempted to leave the html
> objects' ids fairly generic. It could be 2D or 1D. 
> 
> Internally there would be a 2D array to represent the board which 
> is always oriented the same, then the mapping can be changed to have
> white or black at the bottom.
> 
> If you haven't looked at it yet, I suggest you read about the various
> notations for chess moves. It might be a good addition to the UI to
> allow the player to type their moves in, and a big bonus to read the 
> log of moves in standard notation.
> 
> The notation could be very helpful to organize your ideas of how to
> represent pieces and moves.

I have changed and read in tiles that may hold pieces to an object array.

https://midisequenser.000webhostapp.com/chess.html

[toc] | [prev] | [next] | [standalone]


#38584

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-07-22 08:33 -0700
Message-ID<03689df1-f13f-4c13-8c1f-9436bca823bbo@googlegroups.com>
In reply to#38580
Den onsdag 22 juli 2020 kl. 02:25:07 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 21 juli 2020 kl. 19:21:52 UTC+2 skrev luserdroog:
> > On Tuesday, July 21, 2020 at 12:10:38 PM UTC-5, Jonas Thörnvall wrote:
> > > Den tisdag 21 juli 2020 kl. 18:19:15 UTC+2 skrev Jonas Thörnvall:
> > > > Den tisdag 21 juli 2020 kl. 17:17:13 UTC+2 skrev Jonas Thörnvall:
> > > > > Den tisdag 21 juli 2020 kl. 14:13:11 UTC+2 skrev Daniele:
> > > > > > Il 21/07/2020 10:35, Jonas Thörnvall ha scritto:
> > > > > > > Got a little taste for graphical programming. But it was a long time since i did program any sort of game. I think i can see how to program the actual piece movement of pieces "except for maybe castling and draw, and possibly other specialities".
> > > > > > > 
> > > > > > > But howto treat the squares of board? Is each square just an object ID with two properties "occupied/free" "black and white"?
> > > > > > Look at www.lutanho.net
> > > > > > I used the stuff from Lutz Tautenhahn to build a chess site and it works 
> > > > > > nicely. First implementation was with chesstempo, but the script is 
> > > > > > large, while the script from Lutz is more manageable.
> > > > > > 
> > > > > > HTH, Dan
> > > > > 
> > > > > I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> > > > > 
> > > > > JT
> > > > 
> > > > I start to rethink my naive approach, mahbe the square ID what is important and what it hold. There is 64 id's that could hold named pieces or be empty.
> > > > 
> > > > But then again it seem the ID's do have views that change order of layout of ID's depending if you play whit or black.
> > > > 
> > > > Implementing the 64 objects do seem easier then laying them out in two views.
> > > 
> > > And that of course beg the question do each ID have twp positions, but those ID's positions should probably be encapsulated in different views. But each ID still have different position, so do you set the position at printout?
> > 
> > Nit: "begs the question" is a logical fallacy. Prefer "raises the 
> > question".
> > 
> > If I were designing such a thing, I'd be tempted to leave the html
> > objects' ids fairly generic. It could be 2D or 1D. 
> > 
> > Internally there would be a 2D array to represent the board which 
> > is always oriented the same, then the mapping can be changed to have
> > white or black at the bottom.
> > 
> > If you haven't looked at it yet, I suggest you read about the various
> > notations for chess moves. It might be a good addition to the UI to
> > allow the player to type their moves in, and a big bonus to read the 
> > log of moves in standard notation.
> > 
> > The notation could be very helpful to organize your ideas of how to
> > represent pieces and moves.
> 
> I have changed and read in tiles that may hold pieces to an object array.
> 
> https://midisequenser.000webhostapp.com/chess.html

https://1drv.ms/u/s!AonBnYlXpxi4grpLw-6ptwtWRrAtsg?e=R6Fcy5

[toc] | [prev] | [next] | [standalone]


#38572

Fromluserdroog <luser.droog@gmail.com>
Date2020-07-21 09:27 -0700
Message-ID<ad43881e-939e-491b-a564-f723942b2cd6o@googlegroups.com>
In reply to#38570
On Tuesday, July 21, 2020 at 10:17:13 AM UTC-5, Jonas Thörnvall wrote:

> I think i know the answer to this one but i ask anyway. Should the grid numbers and characters be reversed if black is down "your color".
> 
> JT

White always starts on rows 1 and 2. Black always starts on rows 7 and 8.
I think it's typical to rotate the board if the player has the black 
pieces. 

 abcdefgh
8rnbqkbnr
7pppppppp
6
5
4
3
2PPPPPPPP
1RNBQKBNR

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web