Skip to main content

Client library for the bidding game.

Project description

The Bidding Game

This is a client-side bot for the "bidding game".

Rules

This game consists of two people (or bots) that are "bidding" for a high value item, usually described as a bottle of scotch.

There are 11 "places" between each player with the bottle of scotch sitting in the middle. If a player wins a round, the bottle of scotch moves towards the player by one place. If the bottle gets all the way to the end (slot 0 or 10) then that player wins the bottle. If by the end of 10 rounds neither player wins, the game is considered a draw.

To win a round, each player must secretly bid some amount of money. The player with the biggest bid wins that round, and the bottle of scotch moves one position towards them. Each player starts with $100, and must bid in $1 increments. The player who wins the round has their bid deducted from their total, and the player who lost keeps their bid.

In the case of both bids being equal, the player with "draw advantage" wins the round. "Draw advantage" starts with player A, and every time there is a draw, "draw advantage" is switched to the other player.

Finally, you must bid at least $1, unless you're out of money in which case you may bid $0. Make sure you include this as part of your bot or your bids will be invalid and the game will be abandoned.

Making A Bot

The following is necessary to make a bot:

  1. Install this library. This is easily done by running: pip3 install bidbot
  2. Extend the BidBot object.
  3. Connect to a server.

Example bot:

The following is full example of a bot. Note that the only thing a play can really do is pick a bid, you only need to override one object. The following is a bot that randomly picks an amount to play.

from bidbot.BidBot import BidBot
from bidbot.GameState import GameState
from bidbot.BotClient import connect
import random

class RandomBot(BidBot):

    def get_bid(self, game_state: GameState):
        if game_state.my_money <= 1:
            return game_state.my_money
        else:
            return random.randrange(1, game_state.my_money)


def main():

    username = "your_username"
    bot = RandomBot(username)
    host = "your_sever.hostname.com"
    port = 8080

    connect(host, port, username, bot)

if __name__ == "__main__":
    main()

GameState

There's lots of information that can be used to assist you in picking a bid. The following fields are some useful ones:

  • game_state.self.opponent_username - The opponents username.
  • game_state.self.player_identifier - Determines if we are GameState.PLAYER_A or GameState.PLAYER_B
  • game_state.opponent_money - The amount of money the opponent has left.
  • game_state.my_money - The amount of money your bot has left.
  • game_state.bottle_position - The current bottle position.
  • game_state.opponents_bids - A list of the bids the opponent has made up until now.
  • game_state.my_bids - A list of bids that your bot has made up until now.
  • game_state.start_money - The amount of money the game was started with. Typically, this is $100.
  • game_state.rounds_won - The number of rounds that have been won.
  • game_state.rounds_lost - The number of rounds that have been lost.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bidbot-0.1.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

bidbot-0.1.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file bidbot-0.1.3.tar.gz.

File metadata

  • Download URL: bidbot-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for bidbot-0.1.3.tar.gz
Algorithm Hash digest
SHA256 897ab89ac4826612dfc8d5c2ba7b71c62d35d23de43691f9c8f4c240762513f0
MD5 c1047a9c6687c26b4bf7873853c980bf
BLAKE2b-256 fcd25648cc7005ee9e931f7d6eb83a9a2ecc433411fbe63d323937a35dad230f

See more details on using hashes here.

File details

Details for the file bidbot-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bidbot-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for bidbot-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d0651b2ac3571cebea0d9a0774ed8c8847705a9dbec1e9b9d909e71803f66a0
MD5 c7c96336eaf5267febaea7637ef7c0ec
BLAKE2b-256 3a72564a1eb7a4128f2e4b2a2d583a209b5929473f3e84269fc90a4f42084823

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page