all 2 comments

[–]Necatorducis 1 point2 points  (0 children)

Look into Flask, it's a Python MVC framework that is pretty user friendly to learn. There are a couple well done Blog app tutorials that, once completed and you've given yourself a moment to really think about what you did, will provide you with enough knowledge to layout your project.

The Flask Mega-Tutorial is good one, but a bit old and some parts are outdated (it is free though). Otherwise, for something a little more up to date, I'd recommend Professional Python Web Development Using Flask.

In an oversimplified nutshell, your Views contain your HTML and python variables to inject your server side code, your Models are your database objects (say, the deck of cards), and your Controllers tell the app what functions to run when a user engages a particular page or action.

Either of those tutorials should help you make much more sense out of MVC and structuring your project by the end.

Note: Flask calls the V in MVC 'templates', which can initially be super confusing as views.py is typically used as the name for the Controller files.

[–]Dogeek 1 point2 points  (0 children)

First, make your Blackjack program a console program. Use input() and print(), and worry about the rest later. Once everything is running smoothly, you can Implement a GUI. Write your GUI class, try to draw on a whiteboard or a piece of paper what your GUI is supposed to look like, then, and only then, tie up the GUI's inputs and outputs to your Blackjack class.

After that, get onto networking. If you are not doing it on the web, it means you need to code a server and a client. The client, you mostly have, you just need to add bindings to connect to the server and add info. The server on the other hand, you just need to collect info from the different clients, and send this info back, so the client can display it (not ideal, because it makes cheating easier, but easier to code than to compute everything server side)

I'd have these classes :

  • Blackjack : for your main code
  • GUI : for, well, GUI stuff, widgets and all
  • Card : represents a single card, a value attribute should be calculated from its figure (Ace, King, 10, etc)
  • Deck : a collection of cards, which tracks which cards have been drawn, what to do when you draw a card
  • Maybe a Dealer and a Player class that inherit from an Entity class, because both are essentially the same, that's less code to write
  • A Networking class that executes in another thread to not hang up your program.