I made the icy-nord and icy-nord-darker themes.

@promitheas:matrix.org

  • 5 posts
  • 20 comments
Joined 3 years ago
Cake day: June 12th, 2023

EDIT: Literally 1 second after I pressed the post button I got an idea and thats what it was. Why does that always happen? xD

The solution was that my player_hand[] and dealer_hand[] arrays had a size of DECK_SIZE / 2, but I was initialising them to 0 from within the for loop where I was initialising the deck[] array (which has a size of DECK_SIZE), so the last 24 0s of one of those where overflowing into deck[]…

Hello everyone!

I am trying to make a simple blackjack (21) game in C, to practice some pointer stuff, and I am running into an issue with the function that initialises all my arrays. The way I am going about setting everything up, I have an integer array for a standard deck of 52 cards (values from 1 to 13, each 4 times), an integer array for the shuffled deck, and 2 more arrays for the player and dealer hands (irrelevant at this point as they are not used yet).

My issue is that after successfully initialising the deck array (the non-shuffled one) and outputting the values from within the for loop that sets them, I get what I expect to see which is:

1, 2, 3, …, 13, 1, 2, 3, …, 13, … (so on for 52 cards).

But when I output each value from a different for loop in the same function, the first 24 elements (0-23) are 0s each time I run it. I can not figure out why that would be. I ran my program through valgrind which reported that there were no memory leaks.

Here is the relevant code:

#define DECK_SIZE 52

int initialise_decks(int* deck, int* shuffled_deck, int* player_hand, int* dealer_hand, int size)
{
	printf("=================INITIALISING==================\n");
	for (int i = 0; i < size; i++)
	{
		deck[i] = (i % 13) + 1;
		player_hand[i] = 0;
		dealer_hand[i] = 0;

		printf("deck[%d]: %d\n", i, deck[i]);
	}

	printf("+++++++++++++++++++++++++++++++++++++++\n");
	for (int i = 0; i < size; i++)
	{
		printf("deck[%d]: %d\n", i, deck[i]);
	}
	printf("+++++++++++++++++++++++++++++++++++++++\n");


	return INITIALISE_DECKS_SUCCESS;
}

int main() {
	srand(time(0));

	int deck[DECK_SIZE];
	int shuffled_deck[DECK_SIZE];
	int player_hand[DECK_SIZE / 2];
	int dealer_hand[DECK_SIZE / 2];

	int initialise_status = initialise_decks(deck, shuffled_deck, player_hand, dealer_hand, DECK_SIZE);
	if (initialise_status != INITIALISE_DECKS_SUCCESS)
	{
		return INITILIASE_DECKS_FAIL;
	}

	return PROCESS_EXIT_NORMAL;
}

If you need to try it out for yourself here is the link to the github repo

Hello everyone. I just tried to create an account with linode and got the automated cancellation email due to fraud, which left a bad taste in my mouth about the company before I even had the chance to get started.

So I am looking for alternatives that won’t break the bank, have linux options, and are fairly easy to use once you get up and running. I dont need to do anything complex, just host my small hobby projects that I’m hacking away at. I don’t have anything ready now, but I thought that with new years and all that it might be a good time to snag some deals.

Do you guys know of anything that fits? Thanks!

Edit: Decided to go with Oracle’s Always Free option, as at this time being a student (i.e. poor) and just wanting to mess around and learn I can’t justify going with a non-free option when a free on is available. I am however stuck on the part where I need to create my instance. I’m getting the out of capacity error, which after reading up on means there aren’t available resources for my selected region. I can either try again daily to see if at some point they will be available or select a different region (which as far as I can tell means closing and reopening the account which I want to avoid).

  • Currently re-playing Assassin’s Creed 1 and playing Vanilla WoW for the first time on a private server.

    Im remembering how much I liked AC1. I know many people say it wasnt that great of a game, but to me its exactly what an Assassin’s Creed game should be - stalk, plan, stealth, assassinate, escape.

    WoW is also really fun. I tried getting into retail a few times over the years but there was just too much. It was way too overwhelming. Vanilla seems to be just right for a new player.

  • I dont remember the name of it, but you flew around in a blue spaceshit type thing. I think the story involved you being in some futuristic scifi navy/army. One word I can remember being said a lot (i think your wingman or something said it sometimes when you got a kill) is “Casbah”.

    Its not a lot but I was very very young, and played it on my uncle’s PC over a summer while I was visiting my relatives abroad. If anyone has even remotely any idea what Im blabbering about please tell me 😂. Ive been occasionally thinking about it for years.