Giter Club home page Giter Club logo

Comments (4)

pachewise avatar pachewise commented on June 16, 2024 1

Hi @ptudan, are you able to fork the repo and open a PR against this repo from your fork?

On the specific issue, I believe the click library is parsing that command as "-p layers=VB, AB", hence that "first" player is not being parsed correctly and is dropped. I think the right approach to fixing this is: (1) remove the -p alias in favor of always using --players (as opposed to trying to handle when people use the wrong number of dashes); (2) change the for loop in simulate() (see below)

for i, key in enumerate(player_keys):
parts = key.split(":")
code = parts[0]
for cli_player in CLI_PLAYERS:
if cli_player.code == code:
params = [colors[i]] + parts[1:]
player = cli_player.import_fn(*params)
players.append(player)
break

It is better for the person running the CLI to know that they mistyped a player key, rather than have that key skipped altogether.

from catanatron.

ptudan avatar ptudan commented on June 16, 2024

I have a fix for this, but I can't seem to push a branch to open a pull request. Would be great if I could get that permission

It seems like the cli arg parser is shortening the players flag to -p when I didn't use two dashes, but then passing in the rest of the string as an arg (despite there not being a space). I get that this is sort of a user error, but I feel like its worth fixing anyway. I'd say either merge this fix in, or change the arg parser so that -players fails rather than fallsback to -p

I just added this in play.py simulate method

    if len(player_keys) > 0:
        player_keys[0] = player_keys[0].replace("layers=", "")

from catanatron.

bcollazo avatar bcollazo commented on June 16, 2024

Hey @ptudan, thanks for opening up the issue and taking a stab at this!

I like @pachewise's (1) solution. Let's go with that. That gives a user error the one attached, and I like --players=VB,AB being more explicit / clear than something like -pVB,AB anyways. So dropping support for -p! 👍

Screen Shot 2022-09-09 at 10 51 07 AM

Cooking a PR now.

from catanatron.

bcollazo avatar bcollazo commented on June 16, 2024

Addressed with #209.

from catanatron.

Related Issues (20)

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.