Coder Social home page Coder Social logo

combat's People

Contributors

fsmosca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

combat's Issues

Gauntlet with lock side

Hi Fsmosca,
Thank you for this useful Tournament Manager
I hope you are doing very well.
Friendly Request, Could you please add Gauntlet Tournament with option 1 engine always plays white or black (without players swapping sides)

For few rounds played the openings from PGN are always the same - fix proposed

Hello, when using Combat, I figured that the same openings are picked given a opening PGN file.

In function get_game_list, the current code stops adding games from the opening file once it has reached the max_round value and only then the random shuffling takes place :

if file_suffix == '.pgn':
with open(fn) as pgn:
while True:
game = chess.pgn.read_game(pgn)
if game is None:
break
games.append(game)
if len(games) >= max_round:
break
else:
with open(fn) as pos:
for lines in pos:
line = lines.strip()
board = chess.Board(line)
game = chess.pgn.Game()
game = game.from_board(board)
games.append(game)
if len(games) >= max_round:
break

I've modified it such that the opening file is opened entirely, then the shuffling takes place, and only then the first max_round games are kept:

_if file_suffix == '.pgn':
    with open(fn) as pgn:
        while True:
            game = chess.pgn.read_game(pgn)
            if game is None:
                break
            games.append(game)
else:
    with open(fn) as pos:
        for lines in pos:
            line = lines.strip()
            board = chess.Board(line)
            game = chess.pgn.Game()
            game = game.from_board(board)
            games.append(game)
            
if randomize_pos:
    random.shuffle(games)
    
elapse = time.perf_counter()*1000000000 - t1

if len(games) < max_round:
    logger.info('Number of positions in the file {} are below max_round {}!'.format(len(games),max_round ))
logger.info('status: done, games prepared: {}, elapse: {}\n'.format(len(games), get_time_h_mm_ss_ms(elapse)))
logger.info('maxround: {}, len games maxround: {}\n'.format(max_round, len(games[:max_round])))
return games[:max_round]_

Hope this will help improve the Combat script.

Add combat config file

For setting engines, options and others, so that user does not have to edit the source code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.