I have been drawing comics that explain basic programming concepts

William Wise

Smack-Fu Master, in training
61
Right now, I'm writing out the program for my Comic - and yes, I finally chose crazy eights. This is my first draft of this program:

https://github.com/WilliamPWise/crazy-eights/blob/main/crazy_eights_main.py

Note that my programming skills aren't the best, but I tried writing it as clear as I could. It might be a little too elaborate, though... If there's anything I could do to improve the code before I begin storyboarding the chapter demonstrating how it's made, I would definitely appreciate it.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
I think it's awesome you're still doing this project! And thank you for coming back to update the thread!

I wish I'd have remembered it earlier this school year since my oldest is doing a Python class and is struggling a bit with concepts. (From what I've seen so far, I'm not particularly thrilled with the course content and presentation so far.) Now I think it's too late in the year and she probably won't be willing to engage with the material. :/

Regarding the code itself:

Is this an introductory program / skeleton that you're going to walk the reader through improving with your comics, or is this the end state?

One suggestion that jumps out at me immediately is making the concept of a playing card an object/structure of some kind with "Suit" and "Value" properties, with a deck of cards being a collection of those rather than doing the string handling that you're doing.

The other thing that jumped out at me is wondering what the "global" keyword does. Does it declare a variable in the global scope, or does it import a global (or some other non-local) variable into the local scope? I'm mostly asking because draw_cards() references card_deck without calling global, but cpu_turn() and user_turn() both call global discard_pile. (Also, reshuffle_deck() also references discard_pile without using global.)

I'm not at all familiar with Python, so I'm not sure whether those things are OK or not, but it looks inconsistent. There's a good chance there's something I don't know though, so someone who's actually familiar with the language can clarify.
 

William Wise

Smack-Fu Master, in training
61
Is this an introductory program / skeleton that you're going to walk the reader through improving with your comics, or is this the end state?

I'm hoping for it to be a decent enough end state, with just the right amount of ways it could be improved. I.e.: It doesn't have to be completely perfect, but good enough to solve the goal of being a crazy eights program.

One suggestion that jumps out at me immediately is making the concept of a playing card an object/structure of some kind with "Suit" and "Value" properties, with a deck of cards being a collection of those rather than doing the string handling that you're doing.

That I might do if it really would help in the teaching context of this program. I was just going for a more procedural approach for this program to make it easier to follow along in a comic demonstration - And designing classes could prove tricky in this process.

The other thing that jumped out at me is wondering what the "global" keyword does. Does it declare a variable in the global scope, or does it import a global (or some other non-local) variable into the local scope? I'm mostly asking because draw_cards() references card_deck without calling global, but cpu_turn() and user_turn() both call global discard_pile. (Also, reshuffle_deck() also references discard_pile without using global.)

Global means the function can access the chosen variable declared outside that function, so that statements can modify its contents. I found that when I moved the user_turn statements into a function, some methods might modify the outside variables (like pop() ), but other ones can't do that and give declaration errors. So yeah... I might have used discard_pile and card_deck as global variables in some manner - And it probably isn't very ideal.

Thank you for your input!
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
A couple of things to consider, especially given:

I'm hoping for it to be a decent enough end state, with just the right amount of ways it could be improved. I.e.: It doesn't have to be completely perfect, but good enough to solve the goal of being a crazy eights program.

card_is_playable could return early. While there are only 2 possible elements in the "for" loop (the number and the suit), there's no reason to check that the suit matches if you already know that the number matches.

card_is_playable reuses a variable for two different purposes: the number and the suit; that's usually a code smell, and using a class/struct would remove it.

Why are there largely-duplicated methods for the CPU vs. user turns? A lot of that code could be refactored into helper methods that both call. If you want to get a little bit fancy, you could have a "human" and "CPU" class that both implement a base "player" class that handles the basic functionality (the only real difference being in how the two player types choose which card to play). This would also make it easier to add variant AIs ("randomMoveCPU" vs. "suitFirstCPU" vs. "numberFirstCPU" (low-first and high-first variants, even) vs. something that tries to be smarter based on what other players have played).

There's a bug (I think) in reshuffle_deck: if I play an 8, the suit proxy card will get added to the discard pile, so the 8 I played won't be the top card; thus, the 8 I played will be shuffled back into the draw deck so that the computer can play the same 8 on top of itself. The naïve resolution causes an infinite loop if one player has all of the spades and 8s, plays an 8, and chooses "spades" as their suit: the next player would keep drawing and shuffling forever.

reshuffle_deck is pretty inefficient in the way it removes the proxy cards: it could check for proxy cards before appending the discard deck's card to the deck instead of looping through the entire deck 4 times, potentially removing cards from the array each time (and incurring the overhead of moving all of the other cards around).

Why can't I play with 10 CPU opponents? ... or code up 5 different AI players and have them all play each other?

Of course, each of those points could be something you discuss after v1 (the code as-is) is "done" in the comic.
 

William Wise

Smack-Fu Master, in training
61
card_is_playable could return early. While there are only 2 possible elements in the "for" loop (the number and the suit), there's no reason to check that the suit matches if you already know that the number matches.

card_is_playable reuses a variable for two different purposes: the number and the suit; that's usually a code smell, and using a class/struct would remove it.

Perhaps as that's a performance thing, I could use a while loop for that function to return earlier, as for loops in Python are hard to break out of for situations like that.

As I said however - I went for something procedural instead of object oriented, for the fact that I'm using this program for teaching purposes. More specifically on why: I'm assuming that, at the start of the chapter, I'm planning and writing the code from scratch, and building up on how it's actually made at the end. That's as opposed to showing the program at the start, and just explaining how it works. I'd need actual assurance that using objects is the right way to explain this process - I've read that starting to teach coding primarily in an object-oriented manner causes lots of problems in teaching people how to program.

Why are there largely-duplicated methods for the CPU vs. user turns? A lot of that code could be refactored into helper methods that both call. If you want to get a little bit fancy, you could have a "human" and "CPU" class that both implement a base "player" class that handles the basic functionality (the only real difference being in how the two player types choose which card to play). This would also make it easier to add variant AIs ("randomMoveCPU" vs. "suitFirstCPU" vs. "numberFirstCPU" (low-first and high-first variants, even) vs. something that tries to be smarter based on what other players have played).

When I think of coding, I think in terms of breaking down a problem into multiple steps. When I think of how an AI and a User thinks of interacting in a program, they might have very similar parts, but also very different parts, too. To ensure I actually understand what my code does, and to know it works, I reenacted the the steps AI and User separately. Pardon my noobness. :/

There's a bug (I think) in reshuffle_deck: if I play an 8, the suit proxy card will get added to the discard pile, so the 8 I played won't be the top card; thus, the 8 I played will be shuffled back into the draw deck so that the computer can play the same 8 on top of itself. The naïve resolution causes an infinite loop if one player has all of the spades and 8s, plays an 8, and chooses "spades" as their suit: the next player would keep drawing and shuffling forever.

Nice catch - let me see if I can fix the Proxy weirdness somehow.

Why can't I play with 10 CPU opponents? ... or code up 5 different AI players and have them all play each other?

Simply put - I designed the game after the rules of the game I read - which suggest only 2-4 players can play the game. The AI part could be an issue, though.

And yeah - some of those points could definitely be discussion points in my comic. And one other thing I'm also adding after each chapter of my book is a list of questions and activities, so I will take much of the feedback I get into account for them as well.
 

zeotherm

Ars Legatus Legionis
10,960
Moderator
Some of you code could be made more concise (and still readable) with a list comprehensions:

in new_deck:
Code:
>>> card_nums = [ '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace' ]
>>> card_suits = [ 'Spades', 'Hearts', 'Clubs', 'Diamonds' ]
>>> [n + " of " + s for n in card_nums for c in card_suits]
['2 of Spades', '2 of Hearts', '2 of Clubs', '2 of Diamonds', '3 of Spades', '3 of Hearts', '3 of Clubs', '3 of Diamonds', '4 of Spades', '4 of Hearts', '4 of Clubs', '4 of Diamonds', '5 of Spades', '5 of Hearts', '5 of Clubs', '5 of Diamonds', '6 of Spades', '6 of Hearts', '6 of Clubs', '6 of Diamonds', '7 of Spades', '7 of Hearts', '7 of Clubs', '7 of Diamonds', '8 of Spades', '8 of Hearts', '8 of Clubs', '8 of Diamonds', '9 of Spades', '9 of Hearts', '9 of Clubs', '9 of Diamonds', '10 of Spades', '10 of Hearts', '10 of Clubs', '10 of Diamonds', 'Jack of Spades', 'Jack of Hearts', 'Jack of Clubs', 'Jack of Diamonds', 'Queen of Spades', 'Queen of Hearts', 'Queen of Clubs', 'Queen of Diamonds', 'King of Spades', 'King of Hearts', 'King of Clubs', 'King of Diamonds', 'Ace of Spades', 'Ace of Hearts', 'Ace of Clubs', 'Ace of Diamonds']

likewise your draw_card method:
Code:
[card_deck.pop() for i in range(num_of_cards)]

Sorry I can't do more at the moment, I have to go make my kids dinner. Comprehensions can make your intent clearer, BUT if the point is to illustrate basic programming principles (loops in this case) then it may undue what you have taught elsewhere.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
I'm hoping for it to be a decent enough end state, with just the right amount of ways it could be improved. I.e.: It doesn't have to be completely perfect, but good enough to solve the goal of being a crazy eights program.
As one of the architects where I work likes to frequently comment: "Done" is an excellent feature.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
The first note that come to mind is the white space. It would be easier to read the program if you added another blank line between functions just to make it really obvious were a new function begins, or, better, remove the extra lines around your docstrings. Edit: also, I believe that it is traditional to indent Python with four spaces rather than a tab character...

Second, in a program like this, I wouldn't define the globals in the functions. Instead, I would define them at the top of the program (if I used them at all). That way the variable scoping is clearer.

Third, For the players, I might consider defining a number of higher order functions to manage the turn, and pass the logic to determine how the cpu vs human thinks about those decision points. Very roughly, something like:

Code:
def turn(player_name, play_func, draw_func)
    while can_play == False
        count_playable_cards()
        draw_func()
    play_func()

And then make a play_func, draw_func, and whatever other functions need to be different for the human and for the computer and pass them in.

For teaching purposes, I might do a bit of both where I start going down the path you chose and then change based on some of the questions minnmass asked. Alternately, this would be a good place to introduce classes and inheritance. Perhaps even both to indicate the basic idea that a class is a set of data and functions.

In fact, the basic process of doing the same thing twice, noticing you are repeating yourself, and then drying out the code is a pretty good way to introduce concepts like functions, classes, etc. Show the problem, then show how adding the language feature allows you to write less code.

Honestly, you should spend some time instructing the students on the DRY (Do Not Repeat Yourself) principle. A ton of good programming practices and features derive from it.

Finally, I have a disdain for comments like

Code:
# ****The Primary Game Loop****

Such comments are usually an indication that you should write a function called primary_game_loop. Similarly for

Code:
# set up the deck and shuffle it.

Which tells me you should have a function called setup.

Most such comments can be reasonably written into the code itself which has the benefit of forcing the next dev who deals with it to update them when they change the code, rather than leaving them behind to lie to everyone who ever reads the code in the future.
 

William Wise

Smack-Fu Master, in training
61
Some of you code could be made more concise (and still readable) with a list comprehensions:

in new_deck:
Code:
>>> card_nums = [ '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace' ]
>>> card_suits = [ 'Spades', 'Hearts', 'Clubs', 'Diamonds' ]
>>> [n + " of " + s for n in card_nums for c in card_suits]
['2 of Spades', '2 of Hearts', '2 of Clubs', '2 of Diamonds', '3 of Spades', '3 of Hearts', '3 of Clubs', '3 of Diamonds', '4 of Spades', '4 of Hearts', '4 of Clubs', '4 of Diamonds', '5 of Spades', '5 of Hearts', '5 of Clubs', '5 of Diamonds', '6 of Spades', '6 of Hearts', '6 of Clubs', '6 of Diamonds', '7 of Spades', '7 of Hearts', '7 of Clubs', '7 of Diamonds', '8 of Spades', '8 of Hearts', '8 of Clubs', '8 of Diamonds', '9 of Spades', '9 of Hearts', '9 of Clubs', '9 of Diamonds', '10 of Spades', '10 of Hearts', '10 of Clubs', '10 of Diamonds', 'Jack of Spades', 'Jack of Hearts', 'Jack of Clubs', 'Jack of Diamonds', 'Queen of Spades', 'Queen of Hearts', 'Queen of Clubs', 'Queen of Diamonds', 'King of Spades', 'King of Hearts', 'King of Clubs', 'King of Diamonds', 'Ace of Spades', 'Ace of Hearts', 'Ace of Clubs', 'Ace of Diamonds']

likewise your draw_card method:
Code:
[card_deck.pop() for i in range(num_of_cards)]
Sorry I can't do more at the moment, I have to go make my kids dinner. Comprehensions can make your intent clearer, BUT if the point is to illustrate basic programming principles (loops in this case) then it may undue what you have taught elsewhere.

I kind of get what you mean. I'm more or less explaining programming concepts in my comics as if each statement demonstrates one particular action at a time. I haven't quite gotten to the code equivalent of compound sentences in natural language - and I hope to save those kinds of statements for a more advanced book in the future.

---

The first note that come to mind is the white space. It would be easier to read the program if you added another blank line between functions just to make it really obvious were a new function begins, or, better, remove the extra lines around your docstrings. Edit: also, I believe that it is traditional to indent Python with four spaces rather than a tab character...
Your function white space idea sounds like a worthwhile change. But sadly, tab-indents are just too practical for their own good for me to change them. It doesn't break the program either, so I'm not scared of breaking traditions like that.

Second, in a program like this, I wouldn't define the globals in the functions. Instead, I would define them at the top of the program (if I used them at all). That way the variable scoping is clearer.
I was hoping to do that, but for whatever reason, I couldn't find out how. The Python resources I read explained that to make a variable global, I must do so at a per-function basis.

Oh, and one final thought is_card_playable is more idiomatic than card_is_playable
I kind of wrote it that way because the function is supposed to be used in an if statement.

"If card is playable"
versus
"If is card playable"

For the rest of what you suggested, It sounds pretty mind-bending for my amount of skills, but I'll see if I can make more reusable functions - and of course, make the comments adapt to them somehow.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
I kind of wrote it that way because the function is supposed to be used in an if statement.
While that's understandable, it's still not idiomatic.

Ideally you'd be looking at this function in isolation. What does "card_is_playable" do with (or to) the card? By itself, it sounds like it could be making the card playable rather than checking whether or not it can be played. "is_card_playable" is clearer and less ambiguous about the function's purpose when read in isolation.

With regard to comments, they should be reserved for explaining intent if it's unclear from the code itself. Comments are things that still need maintained, yet don't break if they don't match the code -- that makes them dangerous.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
Oh, and one final thought is_card_playable is more idiomatic than card_is_playable
I kind of wrote it that way because the function is supposed to be used in an if statement.

"If card is playable"
versus
"If is card playable"

This is one of the ways that programming languages change the grammar of underlying language, while we wouldn't write "if is card playable" as an english sentence, function names have to stand alone, so "is card playable" is a question which has a true/false answer. So when we say if is_card_playable we are asking the computer to answer that question and make a decision based on the answer.

For the rest of what you suggested, It sounds pretty mind-bending for my amount of skills, but I'll see if I can make more reusable functions - and of course, make the comments adapt to them somehow.

The idea that a function might be stored in a variable shouldn't be all that much more mind bending than the idea that you can store a number in one. In Python, functions are just values, no different than 5. So, you can pass them around just like values. (Sadly C-style languages usually don't get this and so make you jump through extra hoops).

But the other idea is based on a pedological method that I found useful when learning to program: most programming ideas / language features deal with some failing which cause someone to repeat themselves. Functions let you put a title on a paragraph of code and also prevent you from having to write it twice. List comprehensions let you write lists without writing all the loops needed to make the list, etc. Show the failing, then show the solution. Now the solution has context which makes it easy to remember.
 

William Wise

Smack-Fu Master, in training
61
I made a few modifications today, like fix the proxy bug, added some prompt clearing after each turn, and refactoring the is_card_playable function. It might take a while to move more of the repetitive print dialog into functions, but it will happen some way or another.

The idea that a function might be stored in a variable shouldn't be all that much more mind bending than the idea that you can store a number in one. In Python, functions are just values, no different than 5. So, you can pass them around just like values. (Sadly C-style languages usually don't get this and so make you jump through extra hoops).
The comic page I drew on return statements says pretty much that, so it's nice to be assured of it. The mind-bending part for me is more on how apply the 'function as value' in the context of the program I'm doing. I haven't quite done that before in practice, so it's just trying to get used to doing so.
 

zeotherm

Ars Legatus Legionis
10,960
Moderator
Comprehensions can make your intent clearer, BUT if the point is to illustrate basic programming principles (loops in this case) then it may undue what you have taught elsewhere.
I see you trying to submarine functional programming into an introductory lesson. :p
Well, if we want people to learn right, then we should start that way and not teach them the wrong way! ;) :p
 

zeotherm

Ars Legatus Legionis
10,960
Moderator
I kind of get what you mean. I'm more or less explaining programming concepts in my comics as if each statement demonstrates one particular action at a time. I haven't quite gotten to the code equivalent of compound sentences in natural language - and I hope to save those kinds of statements for a more advanced book in the future.
That 100% makes sense, and I think is a good approach to getting what you want across cleanly.
 

William Wise

Smack-Fu Master, in training
61
I'm back again, with a refactor of my crazy eights program:

https://github.com/WilliamPWise/crazy-e ... ts_main.py

There's probably a lot of things to fix, and I still need to push the score management and wincon statements near the end into functions. But I did manage to merge the user_turn/cpu_turn functions into one function, and broke its steps down into even more smaller functions. I also followed a somewhat functional paradigm, where the smaller functions return actual values for the player_turn function. Though they do have to deal with input text side effects.

Is this the sort of refactoring that I should be going for?
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
I would still recommend getting away from ... somebody at work called it "primitive obsession". Card aren't strings, and there's a lot of string manipulation being done to pretend that they are.

I would create a "Card" object which included a suit and rank property. I would define a "CrazyEightsCard" class that inherits from "Card" and adds both an "IsWild" and "VirtualSuit" property. Depending on your design philosophy, the "CrazyEightsCard" might get a "CanBePlayedOn" method or that might remain part of the crazy 8s logic. The virtual suit would need to be reset at some point (there are arguments for "during shuffle" and "when played"; the former feels more natural and may prevent certain classes of bugs, while the latter is simpler to implement as the virtual suit really only matters for the "next" card).

I would also create a "Player" class with properties like "Name" and "Hand". Getting the player's choice of card to play in OOP would generally mean sub-classes ("Human", "SuitFirstComputer", "NumberFirstComputer", etc.), but a callback(?) that determines which "get a card" method to use would be reasonable, too.

Things like player_turn's if player == "You": print(ui_text(player) ) are concerning because they violate separation of concerns - there's UI logic in the middle of a method that should be concerned with orchestrating other methods (that is, player_turn should delegate "display info" to something that's more UI-focused; adding a GUI to this would require significant rework).

Nitpick, but a mulligan is generally a restart to the game, not simply drawing more cards as a normal part of play (eg., in Magic: The Gathering, players may re-draw their starting hand before normal play begins; IIRC, they draw one fewer cards each time they choose to do so).

There are a lot of "magic strings" (eg., if "8" in discard_pile[0]: on line 308 - "8" is a magic string). Magic strings are concerning: if the value needs to change for whatever reason, it needs to be changed everywhere; also, it's unclear to a future reader why "8" is important.

Comments should explain why, not what - right above that if "8" in discard_pile[0]: on line 308 is a comment that explains what's happening; that should explain why shuffling an 8 back into the deck if it's the initial discard pile is desired. The code itself should be clear enough in what's going on. "What" comments are likely to become obsolete as the exact "what"-ness changes, leading to incorrect documentation; "why" comments are much less likely to become obsolete through code changes IME.

Of course, all of this would be good for the tutorial to talk about, transition from a proof-of-concept to a v1 to a v2 of the codebase.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
I'm back again, with a refactor of my crazy eights program:

https://github.com/WilliamPWise/crazy-e ... ts_main.py

There's probably a lot of things to fix, and I still need to push the score management and wincon statements near the end into functions. But I did manage to merge the user_turn/cpu_turn functions into one function, and broke its steps down into even more smaller functions. I also followed a somewhat functional paradigm, where the smaller functions return actual values for the player_turn function. Though they do have to deal with input text side effects.

Is this the sort of refactoring that I should be going for?

Pretty much. The only real observation I have is that the game loop function could use some breaking down, but I think that is something you were thinking about as well.

As for the idea of doing away with the primitives, as a development principle, it's a good idea, however, you are doing this for educational purposes, so I might not. That said, enums would be how you would do that, at least for most of them. The biggest advantage of doing that would be that it prevents spelling errors.

As for the "8 is a magic string" complaint, it might make sense to have something that called is_wild that deals with that.

The we have a few lines of code that I don't particularly love, starting with line 79. while player == "You". This line is misleading in that it implies that the player is going to stop being 'you'. But then, I get that you are combining if player == "You" with a while true. If possible I would look to find a way to say "while a playable card isn't selected".

Next, similarly, you have line 307. It feels like that should say while is_wild(discard_pile[0]), and then, rather than shuffling the deck, I would bury the card randomly in the middle. In fact, you have a few places where you have while true that might be better served with something more specific.

You probably should indeed rename mulligans...

Also, you have a bunch of header style comments, you know things like # Set up the discard pile and its starting card., which to me indicate that you might want to extract a function with that as it's docstring.
 

William Wise

Smack-Fu Master, in training
61
I would still recommend getting away from ... somebody at work called it "primitive obsession". Card aren't strings, and there's a lot of string manipulation being done to pretend that they are.

I would create a "Card" object which included a suit and rank property. I would define a "CrazyEightsCard" class that inherits from "Card" and adds both an "IsWild" and "VirtualSuit" property. Depending on your design philosophy, the "CrazyEightsCard" might get a "CanBePlayedOn" method or that might remain part of the crazy 8s logic. The virtual suit would need to be reset at some point (there are arguments for "during shuffle" and "when played"; the former feels more natural and may prevent certain classes of bugs, while the latter is simpler to implement as the virtual suit really only matters for the "next" card).

I would also create a "Player" class with properties like "Name" and "Hand". Getting the player's choice of card to play in OOP would generally mean sub-classes ("Human", "SuitFirstComputer", "NumberFirstComputer", etc.), but a callback(?) that determines which "get a card" method to use would be reasonable, too.

First off, I'm going to reiterate what I'm not going to design classes for this program, as I still am not confident that for learning purposes it's the right way to begin a programming demonstration. I chose to represent cards as strings because for the most part, this is a text-based program - and in that regard, the info about such cards to be printed out and handled is via strings. Pushing for a "card class" might be an organizational option, but I feel that classes too often obstruct newcomers from the fact that the data you have to handle and control still is primitive numbers and strings.

Until you can prove that designing classes is the best way to teach programming conceptually, I won't use them in this demonstration.

Things like player_turn's if player == "You": print(ui_text(player) ) are concerning because they violate separation of concerns - there's UI logic in the middle of a method that should be concerned with orchestrating other methods (that is, player_turn should delegate "display info" to something that's more UI-focused; adding a GUI to this would require significant rework).

I'm not sure what you mean here. That simply says, "If it is the end-user's turn, Print out the interface for the player's turn." That is, I intended the game to be single player, with one human going against cpu-controlled opponents. I don't need to print out that stuff for the cpu players.

Additionally, my predicament about organizing the text interface part of the codebase is mainly the input() function: I only use it during the end user's turn, but not the cpu turns. But given its nature, I cannot simply print the info all at once, as I have to pause and wait for the user to give input in between much of the interface text.

Nitpick, but a mulligan is generally a restart to the game, not simply drawing more cards as a normal part of play (eg., in Magic: The Gathering, players may re-draw their starting hand before normal play begins; IIRC, they draw one fewer cards each time they choose to do so).

Would something like "deck_draw" and "deck_draw_text" work in place of "mulligans"? I must admit that the terminology is kind of weird.


There are a lot of "magic strings" (eg., if "8" in discard_pile[0]: on line 308 - "8" is a magic string). Magic strings are concerning: if the value needs to change for whatever reason, it needs to be changed everywhere; also, it's unclear to a future reader why "8" is important.

Comments should explain why, not what - right above that if "8" in discard_pile[0]: on line 308 is a comment that explains what's happening; that should explain why shuffling an 8 back into the deck if it's the initial discard pile is desired. The code itself should be clear enough in what's going on. "What" comments are likely to become obsolete as the exact "what"-ness changes, leading to incorrect documentation; "why" comments are much less likely to become obsolete through code changes IME.

That part of the code simply means, "If the card string in the discard pile contains an 8, it has to be sent into the bottom of the deck, and another card from the top of the deck needs to be drawn onto the discard pile in its place. Afterwards, shuffle the deck." It follows the exact rules of crazy eights as far as I know.

As for the "8 is a magic string" complaint, it might make sense to have something that called is_wild that deals with that.

That sounds useful, given how the boolean expression seems to be the same for figuring out whether a card is an 8 or not.

---

As for all the comment complaints, I'm still really confused about how to fix them. I need actual example on what a "good" comment should look like to people here to figure that out. Because I primarily use comments to organize the important steps of the code, and to point out where I really am in a program to prevent myself from getting lost in it.
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
I would still recommend getting away from ... somebody at work called it "primitive obsession". Card aren't strings, and there's a lot of string manipulation being done to pretend that they are.

I would create a "Card" object which included a suit and rank property. I would define a "CrazyEightsCard" class that inherits from "Card" and adds both an "IsWild" and "VirtualSuit" property. Depending on your design philosophy, the "CrazyEightsCard" might get a "CanBePlayedOn" method or that might remain part of the crazy 8s logic. The virtual suit would need to be reset at some point (there are arguments for "during shuffle" and "when played"; the former feels more natural and may prevent certain classes of bugs, while the latter is simpler to implement as the virtual suit really only matters for the "next" card).

I would also create a "Player" class with properties like "Name" and "Hand". Getting the player's choice of card to play in OOP would generally mean sub-classes ("Human", "SuitFirstComputer", "NumberFirstComputer", etc.), but a callback(?) that determines which "get a card" method to use would be reasonable, too.

First off, I'm going to reiterate what I'm not going to design classes for this program, as I still am not confident that for learning purposes it's the right way to begin a programming demonstration. I chose to represent cards as strings because for the most part, this is a text-based program - and in that regard, the info about such cards to be printed out and handled is via strings. Pushing for a "card class" might be an organizational option, but I feel that classes too often obstruct newcomers from the fact that the data you have to handle and control still is primitive numbers and strings.

Until you can prove that designing classes is the best way to teach programming conceptually, I won't use them in this demonstration.

Classes are an incredibly powerful tool that has the great benefit of being conceptually pretty simple. But, the earlier that tool is encountered, the more likely people will be to use that tool.

Classes simplify design by grouping like functionality while simultaneously allowing for "obviously correct" behavior in a lot of places where primitive obsession doesn't - for example, in this project: "8 of Spades" needs to be broken into the rank ("8") and suit ("Spades") a whole bunch of times. Each time that needs to happen, the code needs to know that "Spades" is capitalized, that there's an "of" in the middle, that the king is "King" rather than "K", etc.; if anyone ever needed to change the program to use "spades" or "K" instead of "King", there are a dozen places that need to be touched. If there were a "card" class, there would need to be exactly one.

Classes are how programmers evolve beyond toy programs. Ignoring them hobbles the budding programmer, just like ignoring a screwdriver hobbles the novice carpenter - after all, a hammer will suffice.

So: I see value in showing the "string" version, then talking about "what about if we want to use 'K' instead of 'King'" and how classes help simplify that transition.

Things like player_turn's if player == "You": print(ui_text(player) ) are concerning because they violate separation of concerns - there's UI logic in the middle of a method that should be concerned with orchestrating other methods (that is, player_turn should delegate "display info" to something that's more UI-focused; adding a GUI to this would require significant rework).

I'm not sure what you mean here. That simply says, "If it is the end-user's turn, Print out the interface for the player's turn." That is, I intended the game to be single player, with one human going against cpu-controlled opponents. I don't need to print out that stuff for the cpu players.

The problem is exactly that the code says "If it is the end-user's turn, Print out the interface for the player's turn." - it puts UI logic ("how do I inform the user that it's their turn?") in the middle of an orchestration method. UI and "business logic" should remain separate so that either can change without forcing a change on the other. In this particular case, granted, neither is likely; merging UI and business logic is a shortcut that works well enough in a toy program but that will absolutely bite the novice programmer in the butt as soon as they leave "toy" world.

Additionally, my predicament about organizing the text interface part of the codebase is mainly the input() function: I only use it during the end user's turn, but not the cpu turns. But given its nature, I cannot simply print the info all at once, as I have to pause and wait for the user to give input in between much of the interface text.

Actually, having a single "input" method works here: there's one single place that would need to change if the UI were to change from pure text to a GUI (or even an ncurses-like UI).

Nitpick, but a mulligan is generally a restart to the game, not simply drawing more cards as a normal part of play (eg., in Magic: The Gathering, players may re-draw their starting hand before normal play begins; IIRC, they draw one fewer cards each time they choose to do so).

Would something like "deck_draw" and "deck_draw_text" work in place of "mulligans"? I must admit that the terminology is kind of weird.

What's actually happening? The current player is drawing cards until they can play or the draw pile is exhausted. So, "draw_until_playable_or_exhausted", maybe? Naming things is hard, and I don't particularly like that one, but it's clear...

There are a lot of "magic strings" (eg., if "8" in discard_pile[0]: on line 308 - "8" is a magic string). Magic strings are concerning: if the value needs to change for whatever reason, it needs to be changed everywhere; also, it's unclear to a future reader why "8" is important.

Comments should explain why, not what - right above that if "8" in discard_pile[0]: on line 308 is a comment that explains what's happening; that should explain why shuffling an 8 back into the deck if it's the initial discard pile is desired. The code itself should be clear enough in what's going on. "What" comments are likely to become obsolete as the exact "what"-ness changes, leading to incorrect documentation; "why" comments are much less likely to become obsolete through code changes IME.

That part of the code simply means, "If the card string in the discard pile contains an 8, it has to be sent into the bottom of the deck, and another card from the top of the deck needs to be drawn onto the discard pile in its place. Afterwards, shuffle the deck." It follows the exact rules of crazy eights as far as I know.

That's just it: the comment explains what the code is doing. But, that should be obvious from the code. Comments, when they're necessary at all, should explain why.

As for the "8 is a magic string" complaint, it might make sense to have something that called is_wild that deals with that.

That sounds useful, given how the boolean expression seems to be the same for figuring out whether a card is an 8 or not.

---

As for all the comment complaints, I'm still really confused about how to fix them. I need actual example on what a "good" comment should look like to people here to figure that out. Because I primarily use comments to organize the important steps of the code, and to point out where I really am in a program to prevent myself from getting lost in it.

A good comment explains why the code exists, why a given choice was made. ... or, why a method might get called, in the case of docstring-type comments.

This blog post has some more details and examples, too.

Also, you have a bunch of header style comments, you know things like # Set up the discard pile and its starting card., which to me indicate that you might want to extract a function with that as it's docstring.

Just that: make a method "setup_discard_pile" with a docstring of # Set up the discard pile and its starting card..

Comments are lousy tools for code organization or explaining what the code is doing, in virtually every scenario: there is nothing to enforce that any type of comment change when the code changes, so they have a tendency to quickly become out of date. Comments that explain why the code is doing a particular thing (or how to call a method) are less likely to become stale simply because the reason for the code is less likely to change (and, the method's signature is, similarly, less likely to change) than the actual what - the user will still be asked which card they want to play (or whether they want to draw, even though they might not need to!), but the way they're asked might change. Similarly, comments that say "here's what the next few lines do" are highly suggestive of putting the next few lines into a method - instead of a comment that says # Display the point values of each card:, write a "display_card_values" method and call it; that way, if the call site changes - or the context around the call site does - the "comment" is guaranteed to come along for the ride.

Like with classes and not mixing UI in with flow control, this becomes a lot more apparent when leaving the "toy" world.

And, this is a "toy" program - and that's not a bad thing! They can be a great way to learn concepts and to play around with a new language! But, if you're planning on teaching how to program, stopping with a "toy" is a disservice to your students. Show them the evolution of a simple, straightforward program from "toy" through to quality code that demonstrates the things they'll need if they ever want to contribute to a non-trivial OSS project or work in programming.

The current version of the program is a great second or third step! I would highly recommend keeping it more-or-less as-is as a demonstration of moving from the "toy" world into the ... "adult"? world of programming (along with at least one previous version; this iteration shows a lot of movement in the right direction). But, if I saw this code in a pull request at work, I'd have questions for the author's manager.

... and, that's actually where a lot of "learn to code" tutorials fall apart: they stop with a functioning toy program without any thought given to architecting a project that doesn't fit into 500 lines of code. The novice is then left without the tools they need to better themselves or even the names they need to seek the tools.

Teaching carpentry by explaining how to use a hammer and a saw will, technically, allow the novice to build whatever they want. But: without seeing when a screwdriver might be better than a hammer, or when a chisel or planer might be used - or even that they're things that exist - they'll be stuck doing everything the hard way. Worse, they'll have no idea what to do when a board splits or that there are building codes that they need to follow or how to read industry-standard blueprints. Without exposure to the tools of the trade, they'll never to rise to their potential.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
As for the idea of doing away with the primitives, as a development principle, it's a good idea, however, you are doing this for educational purposes, so I might not. That said, enums would be how you would do that, at least for most of them. The biggest advantage of doing that would be that it prevents spelling errors.

I should note: doing away with spelling errors along those lines isn't a minor benefit. It's a pretty major one, especially when dealing with larger programs. You mention that "even with enums, you are still dealing with primitives" which is true but, it misses the point of enums. Yes, those are stand-is for a primitive value, perhaps a string, but, they also solve the problem of having to recall which primitive value is correct. Because you have one place where the enum is defined, there is a definitive answer to that question, you have a single source of truth; never discount that, it makes it less likely you will write a bug and also makes the code easier to change when the world forces you to (as it always does in real programs).
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
As for the idea of doing away with the primitives, as a development principle, it's a good idea, however, you are doing this for educational purposes, so I might not. That said, enums would be how you would do that, at least for most of them. The biggest advantage of doing that would be that it prevents spelling errors.

I should note: doing away with spelling errors along those lines isn't a minor benefit. It's a pretty major one, especially when dealing with larger programs. You mention that "even with enums, you are still dealing with primitives" which is true but, it misses the point of enums. Yes, those are stand-is for a primitive value, perhaps a string, but, they also solve the problem of having to recall which primitive value is correct. Because you have one place where the enum is defined, there is a definitive answer to that question, you have a single source of truth; never discount that, it makes it less likely you will write a bug and also makes the code easier to change when the world forces you to (as it always does in real programs).

... plus, IDEs typically include some sort of auto-complete; if you get the right enum type, selecting the right value is usually pretty straightforward (or even trivial). No questions about "was it grey or gray".

Enums (and, FWIW, classes generally) also give you type safety in strongly-typed (and even some weakly-typed) languages. This can convert whole categories of runtime errors into compile-time errors (eg.: with an enum for the suit, it's "impossible" to pass "4 of Clubs" into a method that expects just "Clubs").
 

William Wise

Smack-Fu Master, in training
61
Pardon the delayed response.

I've been trying to intake all of what you all are saying, and in the end, I feel like this programming demonstration "Final Chapter" might be so large, it might as well be a book of its own - and I may just make it so instead of be part of the book in itself.

Additionally, I guess I may have to confess this: My programming skills really are limited to what I've gotten done in the the crazy eights program I've made. And full all out object-oriented programming is still way over my head at the moment.

Not that I want that to be an excuse or anything. I could try to make two programs in order to create the programming demonstration: One fully procedural, and then an object-oriented refactor of it. But it will take a while to do, and I don't want to bog down the rest of the 86 pages of comics I've already penciled in, but not laid ink down.

I.e.: I just want some kind of finished product done at some point, and I'd rather save the demo chapter as an extended book to do so. The whole thing really has been a gigantic anxiety attack for me with very minimal collaboration with any programmers, and I don't want it to rage on and on unfinished.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
We really do need to step back and remember the audience here. It's so easy to get caught up in making a perfect program and trying to avoid teaching any bad habits that we leave programming impenetrable.

Putting a warning at the top of the program that this illustrates certain concepts and that software architecture isn't among them should be good enough.

that's actually where a lot of "learn to code" tutorials fall apart: they stop with a functioning toy program without any thought given to architecting a project that doesn't fit into 500 lines of code. The novice is then left without the tools they need to better themselves or even the names they need to seek the tools.
I agree, but at a certain point the author wants to get something out the door. Stepping from simple development to software architecture is a big step. Saying "that's gonna have to be book 2" is a perfectly acceptable response.
 

minnmass

Ars Tribunus Militum
2,087
Subscriptor
We really do need to step back and remember the audience here. It's so easy to get caught up in making a perfect program and trying to avoid teaching any bad habits that we leave programming impenetrable.

Putting a warning at the top of the program that this illustrates certain concepts and that software architecture isn't among them should be good enough.

that's actually where a lot of "learn to code" tutorials fall apart: they stop with a functioning toy program without any thought given to architecting a project that doesn't fit into 500 lines of code. The novice is then left without the tools they need to better themselves or even the names they need to seek the tools.
I agree, but at a certain point the author wants to get something out the door. Stepping from simple development to software architecture is a big step. Saying "that's gonna have to be book 2" is a perfectly acceptable response.

True as this may be, the audience shouldn't be taught bad habits, either. And, I would argue strenuously (and have, I think) that primitive obsession is a bad habit; that mixing orchestration methods with IO is a bad habit; that insufficiently abstracting, especially where doing so is both simple and has clear benefits, is a bad habit; that using hard-coded, magic values is a bad habit; even that using "what" comments is a bad habit.

All of those things are traps that programmers - novice and expert - can fall into. Their siren song lures the unwary to apparent simplicity then dashes them against the rocks of maintainability and extensibility.

If those alluring short-cuts aren't called out as high-risk by the map, the novice will stumble or fall when the danger rears its head.

The most insidious thing about all of those bad habits is that their danger really isn't revealed in the toy programs that programming tutorials typically proffer. The Crazy 8s game fits comfortably within 500 lines of code, including generous whitespace. At that scale, none of those bad habits' dangers are obvious, but that doesn't mean they're not there. Simply because the viper's still in its egg today doesn't mean it won't hatch and envenom you tomorrow.

But, to demonstrate even in the scope of that 500-line program, consider what would be needed to:

* add a suit
* add a suit with the maliciously-chosen name "clubs of fire"
* add an 11 between the 10 and the Jack
* add an 11 of Hearts, but not an 11 of any other suit
* make the Queen of Spades worth extra points
* add Jokers (presumably, they'd be wild, too)
* add a new AI
* let the player choose the difficulty
* implement undo
* allow multiple players via pass-the-device
* use multiple decks
* watch multiple AIs without a human player
* change the wild card to 7
* add a second wild card
* change the UI to Spanish
* ask the players their names; add the name to each player command ("minnmass: Choose a card")

All of those are entirely reasonable (if contrived) feature requests, just off the top of my head. And, none of them cross into the "add a GUI" or "add network play" levels of scope-creep.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
that mixing orchestration methods with IO is a bad habit
This is a bad habit, but it's one I could see opting to elide in a sufficiently small program, with a warning.

that insufficiently abstracting, especially where doing so is both simple and has clear benefits, is a bad habit;
Quite frankly, this is a separate skill that needs developed. It's very easy to miss abstraction points, and it's just as easy to put in too many such that they degrade the readability, maintainability, or even performance of your program. It's something that can be noted in introductory texts, but I wouldn't give it much more attention than a footnote of references to other works that could educate the reader further. (Knowing what to Google isn't good enough -- novice readers aren't going to have the knowledge to evaluate the accuracy of what they find.)
 

William Wise

Smack-Fu Master, in training
61
It has been a while... Hopefully I can still post here.

Just wanted to tell you all: I just got the full black and white comic book done. It ended up being 130 pages of illustrations, all in 8 1/2 by 11 inch format in a pdf. I even put a lot of work in building a custom made font for it, and it's very readable.

Sadly though, I have zero faith in publishing it as a teaching resource. That's because I just could not find pleasure in being a programmer myself. I'm still a novice, and the whole comic is mostly of what a novice like me understands of the subject, in glorious comic form. And thus it shall forever incite heavy criticism of genuine (and ingenuine) programmers all throughout the internet if I publish it. I don't even know if it teaches the subject effectively or not either.

The point: Imposter Syndrome is so high, I won't even show anyone here what the comic book even looks like. You'd have to really convince me hard to do that at no cost - And I'm as stubborn as they come.

What I plan on doing is use a bounty system of some kind, and publish it under a creative commons licence if it is met. And perhaps I'll add another bounty to color the whole thing, too. I will also unpublish the older programming comics afterwards - I don't like them at all anymore.

Either way, after publishing, I'll make no changes to it. I found that the way I tied all 130 pages together, the stuff people might want to change would force me to redraw too much of the comic for me to bear. I've had enough anxiety already of making the comic with little help from experienced programmers, and it has paid a mental toll.

So if you ever get to read it, please respect the comic for was it is - An imperfect perspective from a comic artist.
 

Ardax

Ars Legatus Legionis
19,794
Subscriptor
It has been a while... Hopefully I can still post here.
You'll never not be welcome.

Imposter Syndrome is so high
Congratulations! You're a Real Programmer ™️ now. :D

So if you ever get to read it, please respect the comic for was it is - An imperfect perspective from a comic artist.
I hope you choose to share it at some point, perhaps with the caveats. Hopefully after a bit of distance softens the roughest edges. You clearly poured a lot of effort into it.

An introduction to programming, that's actually educational and entertaining? The project was always ambitious. Not having a love of programming was definitely not going to make the project any easier.

You did it anyway though. That's a hell of an accomplishment.

If you put it in front of a bunch of nitpicky nerds? Yes, a million assholes will find a million things "wrong". You didn't create this for them.

Junior devs fresh from school and code camps still have a whole lot of things to learn and many come with a number of poor habits formed in school. It's not like they come out "good" programmers either.
 
  • Like
Reactions: jerseyboy777

William Wise

Smack-Fu Master, in training
61
Junior devs fresh from school and code camps still have a whole lot of things to learn and many come with a number of poor habits formed in school. It's not like they come out "good" programmers either.
This statement just amplifies how unconfident I am about the work even more. I would think those schools and such are backed by knowledgeable programmers, and given the demand, lots of research would be poured into teaching it right. And compare it to me, just some random self taught novice just referencing internet info and documentation.

I don't even know the "bad habits" you speak of. I guess I read a book called Refactoring, which might give me an idea about making easy to read code. But otherwise, I know next to nothing about real software architecture, aside from maybe 'tests are good' or something.

Blind leading the blind does not sound like the way to teach programming, and that's what my end result feels like - Which is why I don't want to share it like that.
 

Apteris

Ars Tribunus Angusticlavius
9,589
Subscriptor
I'm still a novice, and the whole comic is mostly of what a novice like me understands of the subject, in glorious comic form. And thus it shall forever incite heavy criticism of genuine (and ingenuine) programmers all throughout the internet if I publish it.
I'm reading ancient Greek drama in my spare time, and I've made it to the works of Euripides. He is one of the great fathers of the genre, one of the most thoughtful dramatic writers ever, appreciated during his lifetime -- he got first place at the yearly dramatic competition in Athens five times, no easy feat -- and appreciated even more after his death, even unto the present day, some 2,400 years later. He didn't just master his genre, he advanced it considerably; the greatest minds of antiquity (and not only) sang his praises; it is said that a few lines of his work, recited aloud, saved Athens from destruction in 405 BC.

Why do I mention this? Because even such a titan as this was subject to sustained, malicious, vituperative criticism, both during his lifetime and afterwards.

Arthur S. Way said:
for twenty years, from 425 B.C. to the year after his death, Euripides was the object of the most persistent and merciless attacks from the comic stage. In play after play, from the Acharnians to the Frogs, Aristophanes made him the butt of the keenest and most telling wit that has ever stirred men to laughter. His lines were parodied, his characters were travestied, his plots were burlesqued, his morality was impugned, his friends were slandered, his mother was jeered at, he himself was represented on the stage in disreputable and contemptible situations. And all this was done with such exquisite fooling, with such irresistible drollery, that even the friends of the victim, we may well imagine, could not choose but laugh amid their indignation. Never has any writer endured such a purgatory of ridicule. A Gibber pilloried in the Dunciad, a Keats scourged by the Quarterly, may seem sufficiently unenviable; but no victim of modern satire is exposed to such crucifying publicity, is so utterly unscreened from the tempest of derision, has the mocking faces of a nation so thrust against his own, as he at whom Aristophanes gibed year after year in the great theatre of Athens. Of what iron endurance must have been the soul of the man who could uncrushed sit there, and see the faces of thousands upon thousands agleam with merry mockery of him, could behold them rocking to and fro, "slain with mirth," and hear the laughter surging over tier on tier of the vast curves like the roaring of a sea! Of what steadfast fibre must his purpose have been wrought that he should hold on unswerving in the path he had chosen, bating no jot of heart or hope, but still speaking out the thing that was in him, still publishing to his countrymen and countrywomen the message that was given him for them, through twenty embittered years! By what high thoughts was he sustained, by what loving sympathy comforted, by what consciousness of right made strong, that he fainted not nor faltered, who trod that long path of thorns!

The Tragedies of Euripides Vol. II, Arthur S. Way. Wikisource link
To exist in the world is to be criticised. Publish your work.
 

William Wise

Smack-Fu Master, in training
61
Looking at other advice... The connundrum of my comic continues.

Here's the issue: Should my next comic still be about programming, I can't lie: It would require an expert to work with me to make it from the ground up, with both of us equally investing or brains in building the work.

Doing it alone is no option for me next time, I must tell you: Two years ago, I found a horrible thing about myself, and it is I have some kind of severe executive dysfunction like ADHD. This is self diagnosed: I researched all my learning issues that I've was suffering, and they ended up pointing me to that. I knew I had high functioning autism formally diagnosed much earlier than that, but this ADHD part I discovered so late, and with my monetary situation, I have zero way of getting it formally declared by a doctor, let alone get treatment. Not that I'd accept many treatment options - I am morally against using heavy substance based stimulants.

Either way, I now wondered how I'd get an expert to work with me like that in the first place. And given all the experience I've had failing to invoke genuine teamwork, All I can think of doing is enforce a paid contract on the expert. Volunteers are just unreliable, and I don't think I could find a fully commiting person to work with me otherwise - Even if was an agreement of splitting any profit the comic gets right down the middle. Of course, I would read up on how real teamwork works and such in advance.

I don't know, though... It kind of feels the opposite of what I really wanted: To get paid to do my comic work by the client. It would prove to me that they about the comic being successful intrinsically. The whole sense of bribing someone into putting love in my work just makes me feel... Empty inside.

If I chose the paid contract approach, my only thing of value I have to fund it is the completed comic book itself. Looking at how crowdfunding works, I discovered the bounty idea I had is a no-go - As of late, almost all comics only get crowdfunded as a means to cover the cost of printing it, and not much else. So instead, I'd just publish it on a host like Comixology or something to monetize it. And for that to work... I sense that I'd have to give the comic a big first impression:

To color the entire thing.

Seems like quite an ordeal, even though the comic is perfectly readable in black and white. Yet public feedback of comic art of all kinds always seems to be, "Are you going to color it?" - As though they are illustrations from a coloring book that need to be filled in. However grim this perception, I'd more likely get more customers onboard if I colored my work anyhow.

So unless I get any convincing objections to any of these plans, this is all what I'm going to do.
 
  • Like
Reactions: Diabolical

jerseyboy777

Smack-Fu Master, in training
1
It has been a while... Hopefully I can still post here.

Just wanted to tell you all: I just got the full black and white comic book done. It ended up being 130 pages of illustrations, all in 8 1/2 by 11 inch format in a pdf. I even put a lot of work in building a custom made font for it, and it's very readable.

Hi, I read your old post and followed it to your Legacy Programming Series. It is both entertaining and educational, which is extortionately hard to accomplish. Please don't let other people tear your work down or doubt yourself. Your work would be an awesome way for children or adults to understand the concepts of programming. And I would love to be able to read your new book.

PS I've been programming since I got my first computer, a C64, in the 80's.

Doug
 

William Wise

Smack-Fu Master, in training
61
Definitely a congrats on getting it out the door.

The last 20% of development, publishing, etc, is 80% of the work.
Yeah, it took longer when I felt the comic needed more than it had. Stuff like making a new font, a demo chapter, a constant bunch of changes, and color - They all added up in time. Fortunately, I got an improved workflow out of much of it, so my next series should take much less time.

Speaking of that... I've been wondering about the next book I'll create. If I continued on the computer programming route, what area should I look into? So far, my eyes are on algorithms + data structures, but I'm not sure.
 

Drizzt321

Ars Legatus Legionis
34,920
Subscriptor++
Just noticing this again, congrats!

Point of feedback, I'd add 1 or 2 pages, or partial on the Amazon images so someone can actually evaluate if they seem real/useful/helpful.

Also...would LOVE to not be limited to Kindle. I don't do Kindle, so doesn't work for me to buy/gift. No self-publishing houses that make it reasonable to be able to do that yourself? Or still too $$$ for what you have available?
 

William Wise

Smack-Fu Master, in training
61
Just noticing this again, congrats!

Point of feedback, I'd add 1 or 2 pages, or partial on the Amazon images so someone can actually evaluate if they seem real/useful/helpful.

Also...would LOVE to not be limited to Kindle. I don't do Kindle, so doesn't work for me to buy/gift. No self-publishing houses that make it reasonable to be able to do that yourself? Or still too $$$ for what you have available?
Amazon has a button next to the title page called "Read Sample", Which already previewed the first 14 pages of my book. I never got an option on adding images directly next to the title when I published it.

I could also publish it on other eReaders like Barns & Noble, or as a .pdf on whichever sites that people would feel comfortable purchasing it.

If you really wish for physical copies, Amazon has a self publishing option I could try that prints on demand and makes up the cost of the book itself - But I don't quite know the quality I'd get. I'm just not sure if it's worth the effort yet.