Move Ordering in Javascript Chess Engine chess.js

i am by far a javascript specialist but i am trying to learn it a little.

For the move ordering in my chess engine (i follow a tutorial), i would like to check for captures first.
In the chess.js library the capture moves are listed with the flag ‘c’.

game.moves({ flags: 'c', verbose: true })

so im trying to make a shopping list with first the capture moves, and after that, all the rest moves.
i tried it like this:

var children = [                                                                    
    [game.ugly_moves({ flags: 'c', verbose: true })],
    [game.ugly_moves({ verbose: true })]

like this:

var children = [game.ugly_moves({ flags: 'c', verbose: true })] + [game.ugly_moves({ verbose: true })];

But nothing seems to work.

My code can be seen at at line 153

other info:

Any input is greatly appreciated!


122 thoughts on “Move Ordering in Javascript Chess Engine chess.js”

  1. Hi there! I know this is kinda off topic nevertheless I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest writing a blog
    article or vice-versa? My website discusses a lot of
    the same subjects as yours and I feel we could greatly benefit from each other.
    If you’re interested feel free to send me an email.
    I look forward to hearing from you! Great blog by the

  2. I think what you typed was actually very reasonable.
    But, think about this, what if you wrote a catchier post title?

    I ain’t suggesting your content isn’t solid, but what
    if you added a headline to maybe grab a person’s attention? I mean Move Ordering
    in Javascript Chess Engine chess.js – JavaScript Help is a
    little boring. You should glance at Yahoo’s front page and note how they create
    post titles to get viewers to click. You might add a video or a related pic or two
    to grab people excited about everything’ve written. Just my opinion, it would
    bring your blog a little livelier.

  3. I am extremely impressed with your writing talents and also with the layout
    in your weblog. Is that this a paid subject or did you customize it yourself?
    Anyway keep up the excellent quality writing, it is rare to peer a
    great blog like this one nowadays..


Leave a Comment