Jump to content

gurraglaa

Member
  • Posts

    34
  • Joined

  • Last visited

Everything posted by gurraglaa

  1. No name CPU: 3570k @ 4.5 GHz GPU: Asus 970 Strix @ 1475 MHz RAM: 8 GB DDR3 1600 Scoroe: 6.8
  2. Vessel username: gurraglaa FAV Vids: https://www.vessel.com/videos/LCoY5zfFf https://www.vessel.com/videos/JYZEYDYx0
  3. Don't forget to mention the wheels in these reviews. It's a big deal for people with hardwood floors. If they are hard plastic it will most likely result in black marks on the floor.
  4. Awesome! But the way I see it, one thing is missing: a WAN-show countdown!
  5. @ Thanks to you and a short Lynda lesson about pointers, the program now works! All that is left is to add the rest of the game (pairs, 2 pairs, yatzy etc...)! Feel free to come with criticism on the code and suggest changes that would make it "nicer" code. #include <stdio.h>#include <stdlib.h>#include <time.h>#ifdef _WIN32 #include <Windows.h>#else #include <unistd.h>#endifint iPlayers;char *asNumbers[6] = {"Ones","Twos","Threes","Fours","Fives","Sixes"};void printfield(int *aiField[6], int *aiSum);int main(){ int iRun = 1; int aiDice[5]; int aiKeep[5]; int iTemp; srand(time(0));/*Program starts and the number of players are selected*/ printf("Hi and welcome to Yatzy a la Glaa:D. How many players want to play?\n"); scanf("%d", &iPlayers); while(iRun == 1) { if (iPlayers<5 && iPlayers>0) { iRun = 0; } else { system("cls"); printf("The number of players needs to be between 1 and 4. So I'll ask again, how many?\n"); scanf("%d", &iPlayers); } }/*Declares some necessary arrays*/ int *aiField[6]; int *aiSum = malloc(sizeof(int) * iPlayers); iRun = 1;/*Game starts*/ while (iRun == 1) { /* Creates the play field*/ int *aiField[6]; for (int i = 0; i<6; i++)//Fills the play field with zeros { aiField[i] = malloc(sizeof(int) * iPlayers); for (int j = 0; j<iPlayers; j++) { aiField[i][j] = 0; } } for (int i=0;i<6;i++)//Runs 6 times for the 6 different Dice { if (i>0) Sleep(2000); for (int j=0;j<iPlayers;j++)//Runs as many times as there are players { printfield(aiField, aiSum); printf("This round you want to collect as many %s as possible\n", asNumbers[i]); Sleep(1000); printf("Player %d, it is your turn.\n", j+1); Sleep(1000); for (int asd=0;asd<5;asd++)//Puts the Dice to reroll { aiKeep[asd] = 0; } for (int k=0;k<3;k++)//Runs three times, ones per time you roll the Dice { printf("Your dice: "); for (int l=0;l<5;l++)//Runs 5 times, one per Dice { if (aiKeep[l]==0)//Rolls the Dice if it is not to be saved { aiDice[l] = rand()%6+1; } printf("%d ", aiDice[l]);//Prints the Dice } printf("\n"); Sleep(1000); if (k<2)//Asks the player what Dice he wants to save { printf("What Dice do you want to keep?"); if (i = 0) { printf("Type 1 to save and 0 to reroll (Ex: '1 0 0 1 0' saves Dice 1 and 4)\n"); } else { printf("\n"); } scanf("%d %d %d %d %d", &aiKeep[0], &aiKeep[1], &aiKeep[2], &aiKeep[3], &aiKeep[4]); } } iTemp = 0; for (int a=0;a<5;a++)//Checks how many of the desired Dice there is { if (aiDice[a]==(i+1)) { iTemp = iTemp + (i + 1); } } aiField[i][j] = iTemp; //printf("%d",aiField[i][j]); } }/*Checks who is the winner*/ system("cls"); printfield(aiField, aiSum); //prints the final play field int *aiResults[2]; for (int i=0;i<2;i++)//Creates an array to store the results in and calculate who the winner is { aiResults[i] = malloc(sizeof(iPlayers) / sizeof(int)); } for (int i=0;i<iPlayers;i++)//Fills the array with the results { aiResults[0][i] = (i+1); aiResults[1][i] = aiSum[i]; } int c, d, t; for (c = 0 ; c < ( iPlayers - 1 ); c++)//Sorting the results { for (d = 0 ; d < iPlayers - c - 1; d++) { if (aiResults[1][d] < aiResults[1][d+1]) { /* Swapping */ t = aiResults[1][d]; aiResults[1][d] = aiResults[1][d+1]; aiResults[1][d+1] = t; t = aiResults[0][d]; aiResults[0][d] = aiResults[0][d+1]; aiResults[0][d+1] = t; } } }/*Displaying the results and asks if the player(s) want to play again*/ printf("The results:\n"); for (int i=0;i<iPlayers;i++) { printf("%d place: Player %d with %d points\n", (i+1), aiResults[0][i], aiResults[1][i]); } printf("\n"); printf("Would you like to play again? 1=YES, 0=NO\n"); scanf("%d", &iRun); } return 0;}void printfield(int *aiField[6], int *aiSum){ system("cls"); //clears the cmd window of any text printf("Players:\t"); for (int i=1;i<=iPlayers;i++) //The players are printed { printf("P%d\t",i); } printf("\n"); for (int i=0;i<6;i++) //The Dice and the players points/Dice are printed { printf("%s\t\t",asNumbers[i]); for (int j=0;j<iPlayers;j++) { printf("%2d\t",aiField[i][j]); } printf("\n"); } for (int i=0;i<iPlayers;i++) { aiSum[i] = 0;//sets the Sum to zero } for (int i=0;i<iPlayers;i++)//Calculates the sum of all the players { for (int j=0;j<6;j++) { aiSum[i] = aiSum[i]+aiField[j][i]; } } if (iPlayers==1){//Prints a line based on the number of players printf("------------------\n"); }else if(iPlayers==2){ printf("--------------------------\n"); }else if(iPlayers==3){ printf("----------------------------------\n"); }else if(iPlayers==4){ printf("------------------------------------------\n"); } printf("aiSum:\t\t");//Prints the players sums for (int i=0;i<iPlayers;i++) { printf("%2d\t", aiSum[i]); } printf("\n");}
  6. Hi! I Have not had the time to sit down and code yet. Have too much to do in school. But I think I will take a look tonight. Anyway, thanks a lot for the help. Will make a post when I'm done/when I get stuck again.
  7. I can't seam to get your code to work at all. It gets stuck at the first dize roll. i will take a closer look tomorrow and see if i can fix it. In the meantime, could you please explain how the code above works? I am not that familiar with pointers. In my mind, that code creates a 1 dim array.
  8. Hi! I have just started to learn programming in C. I'm using Code Blocks and gcc compiler (std C99). Just for exercise I have started to make a Yatzy game running in Windows cmd and I have hit a problem that i cant seam to fix. Can you please help me? I have narrowed it down a bit and it seams that the problem lies in the function printfield(). It doesn't save the score of the players correct. If, say for example player one gets 3 ones. Then he should get 3x1 point in the appropriate location of course, but instead I get something like this: Players: P1 Ones 2686584 Twos 2686692 Threes 2686696 Fours 2686700 Fives 0 Sixes 0 ------------------ Sum: 10746672 pic: This is how it should look: Players: P1 Ones 3 Twos 0 Threes 0 Fours 0 Fives 0 Sixes 0 ------------------ Sum: 3 Here is the code: #include <stdio.h>#include <stdlib.h>#include <time.h>int players;char *numbers[6] = {"Ones","Twos","Threes","Fours","Fives","Sixes"};void printfield(int field[6][players]);int main(){ int run = 1; int dize[5]; int keep[5]; int temp; srand(time(0));/*Program starts and the number of players are selected*/ printf("Hi and welcome to Yatzy a la Glaa:D. How many players want to play?\n"); scanf("%d", &players); while(run == 1) { if (players<5 && players>0) { run = 0; } else { system("cls"); printf("The number of players needs to be between 1 and 4. So I'll ask again, how many?\n"); scanf("%d", &players); } }//Asks the player what dize he wants to save/* Creates the play field*/ int field[6][players]; for (int i=0;i<6;i++)//Fills the play field with zeros { for (int j=0;j<players;j++) { field[i][j] = 0; } } printfield(field); run = 1;/*Game starts*/ while (run == 1) { for (int i=0;i<6;i++)//Runs 6 times for the 6 different dize { if (i>0) Sleep(2000); for (int j=0;j<players;j++)//Runs as many times as there are players { printfield(field); printf("This round you want to collect as many %s as possible\n", numbers[i]); Sleep(1000); printf("Player %d, it is your turn.\n", j+1); Sleep(1000); for (int asd=0;asd<5;asd++)//Puts the dize to reroll { keep[asd] = 0; } for (int k=0;k<3;k++)//Runs three times, ones per time you roll the dize { printf("Your dice: "); for (int l=0;l<5;l++)//Runs 5 times, one per dize { if (keep[l]==0)//Rolls the dize if it is not to be saved { dize[l] = rand()%6+1; } printf("%d ", dize[l]);//Prints the dize } printf("\n"); Sleep(1000); if (k<2)//Asks the player what dize he wants to save { printf("What dizes do you want to keep? Type 1 for save and 0 for reroll (Type:'1 0 0 1 0' if you want to save dize 1 and 4 for example)\n"); scanf("%d %d %d %d %d", &keep[0], &keep[1], &keep[2], &keep[3], &keep[4]); } } temp = 0; for (int a=0;a<5;a++)//Checks how many of the desired dize there is { if (dize[a]==(i+1)) { //field[i][j] = field[i][j] + dize[a];//calculates the players point temp = temp + (i + 1); } //printf("Points: %d", temp); } //printf("Points: %d", temp); field[i][j] = temp; //printf("Points: %d", field[i][j]); //Sleep(5000); printf("%d",field[i][j]); } } } return 0;}void printfield(int field[6][players]){ system("cls"); //clears the cmd window of any text printf("Players:\t"); for (int i=1;i<=players;i++) //The players are printed { printf("P%d\t",i); } printf("\n"); for (int i=0;i<6;i++) //The dize and the players points/dize are printed { printf("%s\t\t",numbers[i]); for (int j=0;j<players;j++) { printf("%2d\t",field[i][j]); } printf("\n"); } int sum[players]; for (int i=0;i<players;i++) { sum[i] = 0;//sets the sum to zero } for (int i=0;i<players;i++)//Calculates the sum of all the players { for (int j=0;j<6;j++) { sum[i] = sum[i]+field[j][i]; } } if (players==1){//Prints a line based on the number of players printf("------------------\n"); }else if(players==2){ printf("--------------------------\n"); }else if(players==3){ printf("----------------------------------\n"); }else if(players==4){ printf("------------------------------------------\n"); } printf("Sum:\t\t");//Prints the players sums for (int i=0;i<players;i++) { printf("%2d\t", sum[i]); } printf("\n");} Thanks in advance! // gurraglaa
  9. congratz Linus! I have been following you guys since before LMG and love how you have grown. Every single video since the day I found you (and a bunch of older ones as well) has a view count added by me! Thank you and keep it up guys! 
  10. I love the look of this phone and the fact that dbrand sponsored this video!
  11. Long time sub of ltt & tq and quite a long time jay as well. Keep up the goodo work guys! https://www.youtube.com/watch?v=dZw0dR2e6UQ&list=UU0vBXGSyV14uvJ4hECDOl0Q
  12. this is an acer, but not one in the list. I wold love to see it reviewed. Best notebook in its price rance imo. acer v5-573g
  13. I would love to see this one in the round-up: http://www.ebags.com/product/ebags/tls-professional-slim-laptop-backpack/249582 or their workstation model.
  14. My favorite thing about the M8 is the looks and the feel that the aluminum body provides. Great video guys!
  15. Just needed to say that Edzel is awesome at what he does!
  16. I agree, that would be much better. But I have yet to find out how I reinstall the Windows Installer, witch uses the troublesome file. All I have found this far is this link: http://www.microsoft.com/en-us/download/details.aspx?id=8483 And the files that I found there could not be installed.
  17. Because there seems to be a problem with the file msi.dll, located in that folder. I know enough to be cautious when messing with System32, but not enough to know another way to fix this. If you do, please share your knowledge.
  18. Hi LTT forum! I have tried to install Hamachi.msi and all I get is this message: I have used CCleaner to find and solve dll problems, but that did not help. I have also tried this (from this link, a guy with the same problem, http://community.logmein.com/t5/Hamachi/Cannot-install-Hamachi/td-p/92221) SOLUTION SUMMARY: If anyone else is experiencing the same installation issue, with the error message: "There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor." I recomend deleting the contents of your application Temp folder located at: C:\Users\<username>\AppData\Local\Temp\ This folder contains the reminants from previous installations. It's contents should be safe to delete. Please post here if this solution works for you as well. Finally, although not recommended I'm aware of that, I tried to replace tje msi.dll in System32, but I'm not allowed to replace it even though I give the admin rights (se below). If you know a better way to solve this problem, ignore the pictures below please. The marked alternative means "replace the file in the target" (Sorry, Swedish OS... Win 8 64bit btw) Translation: Admin rights is needed, I press "fortsätt", which means proceed. Translation: You need admin rights to preform this task. (this is shown after I give the "admin approval above) These messages are shown when I try to copy a replacement msi.dll file found on the web to System32 and SysWOW64 in the order above. Google has not been my friend in this matter, so hopefully some good sole here at LTT can be my savior. My Minecraft-playing needs grow stronger by the minute! Thanks in advance!
  19. 1. I run a 120gb 840 Samsung ssd because it was cheap and it's a great drive for the price. For storage I up until recently had a WD 500gb for media and a Seagate 360gb for games. I used these because I had them laying around when I built my pc this spring. But I just got 2 2tb Seagate drives witch i put in my old pc to make an Ubuntu server. I choose these because they were on sale and I want a server/nas to be able to access my files from anywhere, anytime. The 2 drives are in RAID 1 for security. 2. Facebook share from Gustaf Glaad: https://www.facebook.com/gustaf.glaad?hc_location=stream 3. Twitter share with Twitter handle @GustafGlaad: https://twitter.com/GustafGlaad 4. Community Site share with nickname gurraglaa:http://www.swedroid.se/forum/showthread.php?t=100294&page=18
×