►
From YouTube: W13 TEC Lab!: ChessCAD!
Description
See the code from this session here:
https://github.com/tecommons/tec-lab
🙏 Thank you for watching! Hit 👍 and subscribe 🚩 to support this work
🌱Join the Community🌱
on Discord https://discord.gg/uM4ZWDjNfK
or say hello on Telegram https://t.me/tecommons
Join the conversation https://forum.tecommons.org/
Follow us on Twitter: https://twitter.com/tecmns
Learn more http://tecommons.org/
A
Like
weird
taste
in
the
mouth
and
a
lot
of
pain
in
the
neck,
but
I
don't
know
it
wasn't
that
bad
and
I'm
still
a
bit
like
I
have.
I
have
to
go
to
bed.
A
B
B
Probably
we'll
get
a
few
more,
but
I
do
want
to
start
early
because
it's
very
ambitious.
I
don't
really
know
what
I'm
doing,
but
I
think
we
can
make
some
progress.
I
have
some
ideas.
B
Okay,
I'm
usually
free
friday
afternoons
so
this
afternoon,
sometime.
A
A
A
B
At
some
point,
oh
what
matt?
Oh
you
mean
the
get
coin
stuff.
B
B
Yeah,
that's
every
thursday
there's
live
hack
sessions.
Actually
next
thursday,
I'm
doing
a
little
bit
of
a
session
on
on
ai
in
that
so
yeah,
that's
the
most
advanced
class
on
thursdays,
but
I
don't
want
to
get.
A
A
B
B
A
whole
chest:
simulator
yup
love.
You
thanks:
jake,
hey
juan
nice,
to
have
you
here.
Sorry,
I
missed
the
graviton
session.
Yesterday
I
had
too
many
things
happening
yesterday.
B
B
B
B
Nice,
so
yeah
today
is
quite
an
ambitious
feat.
I'm
a
I
was
a
little
bit
stressed
last
night
worrying,
but
I
think
we'll
just
have
some
fun
with
it
and
see
how
far
we
can
get
lab
13..
I
must
have
missed
an
attendance
day,
but
that's
okay,
chess
cad
okay,
so
I
should
have
probably
put
some
agenda
notes
in
here
beforehand,
but
that's
okay,
so
first
we're
gonna
grab
a
template,
get
a
template
for
cad
cat,
then
we're
going
to
implement
chess
state
variables.
B
And
so
it's
going
to
be
the
board
and
which
player's
turn?
It
is
that's
essentially
most
of
what
we
have
to
do:
we're
going
to
have
to
implement
the
moves
which
will
be
the
difficult
part
and
then
we're
going
to
have
to
implement
the
player
logic
so
that
a
player
can
understand
what
moves
they
have
available
and
then
choose
a
move
and
essentially
that
and
then
we
run
the
simulation.
B
That's
a
good
question,
so
I
think
part
of
this
implementing
the
state
so
maintaining
the
state.
We
can
keep
track
of,
captured
pieces
captured
pieces,
and
so
we
can
sum
up
their
points,
so
we
could
have
a
score
and
now
it
would
be.
A
B
A
A
B
Okay,
maybe
I
need
to
remember
where
it
is
so
in
the
research
group
with
git
coin,
I
gave
a
presentation
on
reinforcement
learning
in
in
the
simulations,
and
I
made
a
really
simple
example.
So
I'm
going
to
see
if
I
can
jump
to
bitcoin
research-
and
I
should
have
a
notebook
here
that
is
called
yep-
it's
this
toy
reinforcement,
learning,
okay,
so
I'm
just
gonna
copy
that
here
so
copy
home,
slash,
workspace,
tpc
get
coin,
and
then
it's
called
toy
rl
and
dot
slash
okay.
B
B
B
So
I'm
not
sure
if
we
need
really
any
system
parameters,
but
we
might.
We
can
come
back
to
this
I'll.
Just
leave
this
in
here
as
an
example.
B
Initial
state,
so
this
this
is
really
it.
This
is
where
most
of
the
setup
is
gonna
happen,
so
we're
gonna
think
about
how
do
we
encode
a
chess
game
so
first
we're
gonna
have
to
make
a
board
well
we're
gonna
have
to
represent
the
pieces
to
start
so
all
of
everything
you're
gonna
see
here.
I
just
just
came
to
me
in
a
dream.
B
I've
just
been
dreaming
about
this
stuff
this
week
so,
and
I
also
did
a
similar
assignment
once
in
my
undergrad,
so
I
kind
of
have
some
faint
recollection
of
that,
so
we're
gonna
have
to
represent
our
pieces.
So
imagine
in
your
head
now
sort
of
visualize
the
chess
board
right,
and
so
this
is
why
I'm
glad
tonga
is
here.
Tonga
has
a
background
in
professional
chess
playing,
so
he's
going
to
be
able
to
catch
some
of
the
subtleties.
B
A
Yeah
yeah,
when,
when
you
write
in
chess,
you
use
the
and
only
for
the
night,
I
think.
A
B
Okay,
so
so,
let's
visualize
the
chess
board,
let's
say:
okay,
so
the
chess
board's
in
front
of
us,
let's
say
we're
the
the
white
players?
Okay,
so
let's,
let's
actually
start
at
the
top
at
the
back
of
the
board.
So
you
know
if
we
from
our
perspective,
we
have
the
white
pieces
and
let's
imagine
that
what
we're
defining
here
are
the
is
the
very
back
of
the
board.
So
it'd
be
the
black
pieces.
A
B
Let's,
let's
keep
it
simple
for
now.
I
think
it'll
work
out
so
let's
say
black
pieces
and
then
I'm
just
gonna
do
this.
I'm
gonna
go
white
pieces
equals
the
p
for
piece
dot.
Since
this
is
a
string
we
get.
This
function
called
lower
for
p
in
black
pieces
and
then
what
that
looks
like
is
this,
so
this
is
going
to
make
our
algorithm
super
simple,
because
we
can
always
when
we
need
to
know
what
moves
black
has
available,
we're
going
to
check
for
uppercase
pieces.
So
now
we
have
black
pieces
white
pieces.
B
Okay,
okay,
so
I'll
just
put
this
so
that
we
can
keep
track
of
it.
So
we
need
three
four,
I
think
that's
right
and
then
similar.
Let's
do
this.
B
Pawns,
okay,
white
pieces,
white
pawns,
okay,
so
now,
let's,
I
think
we'll
just
use
an
x
for
an
empty
space,
so
we're
going
to
have
to
compose
the
whole
board.
So
the
board
is
going
to
be
a
list
of
lists.
B
B
B
B
B
B
B
B
Yeah,
like
we
could
augment
the
game
through
these
things,
we
could
make
different
rules,
for
example,
rule
sets
and
stuff
like
that.
B
I
know
python
is:
is
too
powerful?
Okay,
so
turn
is
gonna
be
starts
with
white
and
I'm
gonna
make
one.
Oh,
I
wrote
a
bunch
of
notes
in
my
notebook
the
other
day.
Let
me
flip
to
that
page
to
see
if
there's
anything,
I'm
missing
yeah.
So
we
can
have
finished.
B
None
we
could
have
move
number.
B
B
Basically,
this
is
player
one
and
this
player
two.
So
we
can
say
the
white
pieces
are
player,
one
and
the
black
pieces
are
player
two.
B
B
B
We
have
to
implement
a
move.
Okay,
so
I
don't
know
how
long
this
is
going
to
take.
Hopefully
we
can
do
this
in
like
10
or
15
minutes,
but
so
I'll
just
make
m
I'll
start
all
these
with
m
for
move
and
then
I'll
just
say,
r
or
let's
say
rook.
B
Okay,
so
and
I
think
we're
gonna.
What
we're
gonna
have
to
do
is
we're
gonna
have
to
understand
like
indices
of
the
board.
So
let's
take
the
board
and
say
it's
a
list,
so
we
can
say
the
the
first,
the
first
row
and
the
first
column
is
an
r
okay.
B
B
And
also
we
have
8
by
eight
right.
So,
let's,
let's
just
work
with
an
example.
So
let's
say
I
equals
two
and
j
equals
five.
B
B
We
can
see
where
that
is
on
the
board,
so
board
of
I
j
is
a
zero.
It's
too
bad.
We
can't
like
visualize
this
on
the
board.
We
probably
could,
if
we
put
some
thought
into
it,
but
let's
think
this
is
the
second
row
and
the
fifth,
oh,
so
it's
zero
index.
So
we
have
zero
one,
two
zero
one,
two,
three,
four:
five:
okay.
So
this
is
what
I
and
j
is
in
our
example.
B
B
So,
let's
use
an
thing:
a
new
indicy
called
k,
for
which
is
I
mean
it's
where
we're
moving
to
4k
in
range
and
we're
moving
up,
which
means
our
row
is
going
to
be
decreasing
because
rho
0
is
at
the
top,
so
we're
and
we're
currently
at
I
so
we're
going
to
go
from.
I
to
0
and
I
think
we're
going
backwards,
so
we
say
negative
one.
Let
me
just
test
that
out
so
for
k
in
range,
let's
say:
seven
to
zero
negative
one.
B
That's
our
step
print
k
yeah!
So
we
go
backwards
to
one,
but
we
actually
want
to
go
to
zero.
B
B
B
B
If
the
piece
is
lowercase,
then
it's
ours.
If
it's
uppercase,
it's
the
enemies.
B
So
if
we
can
do
it
like
this
piece,
so
this
piece
here,
this
variable
is
going
to
be
a
string.
It's
going
to
be
like
uppercase
p,
or
something
like
that
or
may
yeah.
It
won't
be
okay.
The
first
case
is
that
the
piece,
if
piece
equals.
B
Zero
then
it's
empty,
so
we're
going
to.
We
can
move
there
or-
and
we
can
also
continue
so
we're
going
to
continue
and
what
this
keyword
does.
It
means
don't.
It
means
just
go
to
the
next
step
in
the
loop.
Don't
even
don't
even
evaluate
all
the
logic
that
comes
next,
just
keep
looping
and
that's
what
we
want
here,
because
if
it's
a
zero
we
can
just
keep
going
and
if
it's
not,
then
we're
going
to
check
if
the
piece.
B
So
that
means
we
can
move
from
into
c
I
to
indic
k
minus
one
going
up
see
this
is
getting
quite
complicated
fast.
I
was
worried
about
this.
How
much
time,
maybe
I
should
have
pre-populated
these
beforehand,
and
this
is
only
the
rook,
and
this
is
only
moving
upwards,
so
dang,
okay,
let's
just
keep
going-
I
guess
yeah.
A
B
Well,
this
is
the
cool
part
it's
like.
If
we
get
all
the
logic
wired,
then
we
can
just
throw
it
at
cad
cat
and
cad
cad
will
simulate.
I
mean
there's
two
pieces
so
actually
also
in
this
template,
so
we
have
all
the
cad
cad
here
then
we
also,
I
have
some
reinforcement,
learning
agents,
so
if
we
could
just
throw
them
in
the
simulator
and
have
them
run
forever,
then
they,
theoretically,
that
we
could
just
make
some
really
really
powerful
chess
ai
bots.
A
I
mean
the
queen
is
just
the
bishop
in
the
rook.
Okay,
the
knight
has
a
pattern,
so
you
need
to
do
rook,
knight,
bishop
and
king
in
pawn,
and
then
everything
should
be
done.
B
B
B
I
think
it's
going
to
be
plus
one
because
we're
going
up,
which
means
actually
we're
decreasing
our
indices
so
and
then
we're
going
to
break
this
loop.
So
if
we
go
break
then
we
should
quit
out
of
this
for
loop
now
there's
the
final
case
here.
B
Elsif
piece
dot
upper.
B
B
B
B
B
Line
or
check
it's
just
a
single
point,
actually
checkpoint
compatible.
I
don't
know
checkpoint
for
move.
B
B
Yep
cool
continue.
B
A
B
B
Not
sure
what
this
oh,
is
it
just
indented
too
much,
maybe
no
continue
not
properly
in
loop.
Oh
we're
not
in
okay.
So
let's
just
try
like
return.
B
B
B
Whether
or
not
we
continue
or,
let's
just
say,
yeah
keep
moving
equals
checkpoint
for
move
and
we
have
k
and
j
and
player
okay
and
then
oh,
we
should
actually
return
the
the
k.
So
in
this
case,
let's,
let's
return
negative
one,
because
we
should
never
k
should
never
be
negative
one,
because
that
would
be
off
our
board.
So
if
it's
negative
one,
it
means
we
just
keep
moving.
Otherwise
we're
going
to
return
k
plus
one.
B
If
keep
moving
equals
negative
one,
then
we
continue
in
our
loop
else
max
up
equals,
keep
moving.
Now
that
the
naming
there
is
maybe
a
little
bit.
B
A
B
I'm
just
gonna
call,
it
evaluate
sure,
evaluate
move
now,
because
that's
like
what's
the
performance
of
the
move,
movable
is,
can.
B
B
B
B
B
B
B
B
So
this
looks
this
is
actually
right
now,
if
we're
going
right,
we're
going
to
eight
and
we're
going
by
plus
one
and
same
here
for
down
this
should
be
eight,
and
this
should
be
plus
one
okay.
B
Oh
yeah
see
this
needs
the
board.
So
let's
pass
the
board
in
here.
B
B
B
B
Max
up
max
left
max
right
and
max
down,
so
it
says
we
can
go
up
and
left
what
do
these
really
mean
one
and
seven?
Let's
take
a
look
at
our
board
again.
B
B
B
B
B
B
B
B
Yeah,
okay,
maybe
this
should
be
k
and
the
other
one
should
be
k
minus
one.
A
B
B
Yep,
so
this
this
is
just
off.
This
is
like
inverted.
This
should
actually
be
zero
instead
of
eight.
So
that's
when
we're
checking
for
right
and
down
so
right,
we're
going
from
zero
to
eight
and
we're
checking
each
allowed
move
and
if
allowed
is
negative
one.
So,
let's
check
max
right
so
again
same
thing:
we're
going
to
have
we're
going
from
k
equals
zero,
so
this
is
going
to
be
zero
zero
and
it
should
return
it
should
trigger
on
the
first
iteration.
But
it's
not
it's
going
all
the
way
to
the
end.
B
Let's,
okay,
this
one
seems
to
work
for
now.
Let's
take
out
these
print
statements
and
let's
just
put
them
here.
B
B
B
But
let's
put
a
random
black
rook.
B
B
4,
four,
okay,
so
it's
telling
us
that
we
can
move
in
all
directions,
four,
but
that
doesn't
quite
seem
right.
Either
we
should
be
able
to
move
left
one
one,
two,
three,
four
and
right
one:
two:
three
and
down.
B
B
B
A
I
don't
I
didn't
want
to
complicate
it
much
for
you,
because
it
wasn't
very
complicated,
but
in
the
world
usually,
we
see
stuff
like
we
make
the
board
eight
by
eight,
and
then
we
call
the
first
line
a
the
second
line
b,
then
line
c
and
from
the
bottom
to
the
top,
a
one
two,
three,
four,
five
until
eight
and
from
left
to
right
a
to
h,
that's
how
the
moves
are
called.
I
don't
know
if
that's
helpful
for.
B
A
B
Tonka,
I
was
actually
thinking
about
this
so
from
bottom
to
top.
A
B
Eight
yep,
so
this
is
this-
is
cool
to
know.
So
we
can,
we
can
put
this
in
there
it'll
make
it
more
realistic
and
it
might
actually
it
could
possibly
simplify
things
because
then
we'll
be
able
to
visualize
easier
which
which
step
we're
on.
B
So
I
think
after
the
hours
up,
I
think
I'll
refactor
this
a
bit,
but
hopefully,
let's
see
if
we
can
get
this
rook
move
working.
B
B
B
Yeah,
it's
saying
hey,
I
am.
This
is
my
own
piece.
I
can't
attack
it,
so
I
can't
go
anywhere,
so
we
need
to
skip
the
the
s
the
tile
that
we're
already
on.
So
it's
just
this
loop.
B
B
A
What
is
interesting
for
me
is
that
that
you
are
making
like
in
this
array
it's
like
you're
making.
This
is
either
a
piece
or
a
square
like
in
chess.
We
think
a
piece
is
in
a
square,
but
here
it's
like
if
it's
an
empty
square
or
or
a
piece,
you
know.
B
Yeah
good
point:
we're
not
really
modeling
the
squares,
and
I
thought
about
that
too,
and
griff
mentioned
something
like
the
black
and
whiteness
is-
is
somewhat
important
right,
but
I
was
thinking.
Can
we
get?
Can
we
get
a
full
simulation
by
going
around
that
with
just
just
modeling
the
pieces
instead
of
the
squares.
B
So
this
is
still
so
it's
saying
up.
It's
saying
up.
We
can
go
one,
but
I
think
it
should
be
two
one,
two
okay,
so
unless
it's
like
zero
indexed
but
but
anyways,
these
are
definitely
incorrect.
Yet
so
let's
keep
thinking
so
we're
going
up.
So
it
checks
this.
This.
A
B
B
B
Oh
yeah,
actually,
this
is
correct.
Wait!
No!
No!
It's
not
quite
correct!
So
it's
3,
4
2,
4,
1
4,
and
it
should
return
so
it
realizes
that
it
can't
go
there.
So
it's
checking
1
4,
which
is
here,
and
it
returns
a
1..
B
Oh
no,
it
sees
that
it's
our
own
piece,
okay,
so
this
so
this
depends
which
way
we're
going.
So
there
is
there's
a
bug
in
this
because
it
depends
if
we're
ascending
or
descending,
it's
going
to
be
these
these
plus
ones,
or
so
this
plus
one
and
this
it
depends
on
whether
or
not
we're
ascending
or
descending,
so
it
differentiates
like
so
basically
up
and
left
are
going
to
be
different
from
right
and
down.
B
We
might
be
able
to
simplify
all
of
this
into
a
single
case.
That's
just
like
move
forward,
and
so
it
doesn't
need
to
know
which
direction
it's
moving.
It
just
knows
that
it
can
move
forward.
I
guess
that's
what
this
is,
but
I
think
I'm
going
to
have
to
refactor
this
this
code.
This
was
a
single
approach,
so
we're
definitely
going
to
have
to
do
a
follow-up
lab
we're
going
to
get
this
working
tonga
and
maybe
tonga
we
can
do
a
session
outside
of
the
lab.
A
B
B
Yeah,
I
think
I'll.
I
think
I'm
gonna
play
around
with
this
a
little
bit
a
little
bit
offline
and
and
come
back
I'll,
get
a
bit
more
prepared.
A
I
have
I
have
another
idea
because
after
chess,
I
played
poker
for
many
years
and
there
is
a
lot
of
poker
simulators.
Okay,
excellent
yeah.
I
I
I
like
those
simulators
there
is.
They
are
not
open
source,
they
are
closed
source
and
like
they
are
so
very
expensive.
So
yeah,
that's
another
idea
for
when
we
learned
that.
A
B
Want,
obviously,
I
would
love
to
do
that.
That's
so
cool.
A
B
Okay,
so
unfortunate
we
weren't
able
to.
I
was
a
bit
over
ambitious
thinking.
We
could
make
the
whole
chess
game,
but
we're
definitely
gonna
get
it.
A
B
B
B
A
B
B
They
use
these
unicode
text
characters
to
actually,
because
these
are
the
chest
is
actually
built
into
text.
Encoding.
B
It's
given
the
game
board
see.
This
is
very
similar
to
what
we
were
making.
This
is
just
a
bit
more
elegant,
so
it
returns
x,
x,
y
y
for
x,
x
y
y
in
king
list.
Okay,
so
they
have
this
king
list
x
y,
oh
yeah,
and
then
they
have
a
function,
no
conflict,
interesting,
so
where's.
This
king
list.
A
Before
we
finish
like
in
the
reasoning,
you
were
only
going
to
add
capture
pieces,
but
there
is
a
lot
more.
B
A
B
A
B
B
These
stable
baseline
agents
that
use
reinforcement,
learning
so
basically
they're,
just
gonna,
observe
the
board
and
then
they're
gonna
they'll
get
back
a
set
of
legal
actions
that
they
can
take
and
they're
going
to
take
an
action,
and
these
algorithms
have
like
this
deep
learning
policies
built
in
so
that
they
start
to
learn
how
to
map
better
and
better
actions
based
on
the
reward.
So
the
reward
will
be
essentially
if
they
win
the
game
or
not,
or
we
could.
B
A
A
A
A
A
A
Alpha
zero
made
so
much
progress
such
as,
like
the
top.
The
top
players
started,
copying
alpha
zero
wow,
so
much.
B
B
B
A
B
Cool
okay!
Well,
I
think
I'll,
I'm
gonna
sign
off
tonga,
but
thanks
for
all
the
advice,
I
think
we
should
probably
just
grab
this
next
time
and
put
it
into
cad
cad.