Golf.py

Golf.py

11 devlogs
10h 33m
•  Ship certified
Created by Freddie

Golf is a multiplayer card game in which every player competes to finish with the lowest score. Golf.py is a python command-line game where the user battles the computer in a game of virtual Golf! May the best golfer win!

Timeline

Compiled to an executable

Update attachment

Ship 1

1 payout of shell 132.0 shells

Freddie

about 2 months ago

Freddie Covers 10 devlogs and 10h 25m

Done! I made it :)

Update attachment

Completely remade the bot. It now simulates every possible move, and decides what to do based on the moves that reduce the bot's score the most.

Update attachment

I improved on the way a position in the user's hand is inputted. Previously, the user was prompted to enter the row and column of the card separately. I found this to be unintuitive, and too easy to make mistakes. I have now opted for a 'spreadsheet' style input where the rows and cols are defined as letters and numbers (e.g., A1 = 0, 0). This is easier to use. I also made it so that the game ends when a player has all of their cards face-up, and the winner is calculated.

Update attachment

Instead of ugly text, I made a function to render the cards so they look nice :)

Update attachment

Improved the bot now, it is pretty good at the game. At the moment, it doesn't take into consideration the player's hand, so it doesn't play the best possible move every time.

Update attachment

I got the bot working. Its in its early stages, so its pretty dumb. I will try to improve on it.

Update attachment

Ok.... I added some comments to the code, and tidied it up a little. I also made it periodically clear the terminal, so that it doesn't get too cluttered and still looks nice. Also more colour because colour is fun!

Update attachment

Started on the game loop, added some terminal colours using ASCII sequences. The decks and hands are randomised when the program is run. Added lots of input validation to make sure there are no errors :)

Update attachment

Created class for a player's hand. The cards stored in a 2D array since there must be two lines. I also added some basic code to print out the player's cards next to the computer's cards as tables, using the tabulate module.

Update attachment

Created the base classes for the game: Pile and Card. The Pile class contains an array called cards, which holds all of the cards in the pile. It can be initialised to contain a whole deck, and can be shuffled. The Card class can be used to get the score of a card, or to get the name of the card as a string

Update attachment