Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

[Programming - C] character generator for a game

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Context:





Question:



Code I have thusfar:



http://pastebin.com/Gs8rfGs2

d y : a dice of Y sides (ie d6)

x d y: X number of Y sided dice (ie: 3d6 = 3 x 6 sided dice)

Hitdice: The type of dice rolled for hit-points or a Class/Profession. (ie: d4, d6, d8)

Skill Structure: struct Skill { char name[20], char optional[20], char short_desc[250], int stat_affinity, int ranks, struct Skill *next_Skill;};

Class Structure: struct Class { char name[20]; int Hitdice, Str_Dice, Dex_Dice, Con_Dice, Int_Dice, Wis_Dice, Cha_Dice, Skill_Points; double BAB_Type; struct Class *next_Class;)};

Is my hitpoint formula correct? Does my code seem to satisfy the question requirements? Are my Hitdice and Class structures correct? If not, how would one do this?
 
lowercase baba
Posts: 13048
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First...welcome to the Ranch. We are glad you stopped by.

Next...wow. That is just a LOT of stuff there. 100+ lines of code is bad enough, but then you have three or four images with more stuff in them...which is hard for us old guys to read. Plus, since it is an image, nobody can easily search it to find where it talks about "hit point formulas".

You'll find that you'll get better help here if you ask focused questions, posting only the relevant parts of your code needed to illustrate your issue. The easier you make it for someone to help you, the more likely you are to get that help.

Having said all that...WHICH hit point calculation are you trying to do? at one point in the specs, it says HP should be (level * rand()%6 + 1). Elsewhere, it says HP should be calculated as 1d6 + [Con bonus] per level.

Which are you trying to do?
 
James Kerry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:First...welcome to the Ranch. We are glad you stopped by.

Next...wow. That is just a LOT of stuff there. 100+ lines of code is bad enough, but then you have three or four images with more stuff in them...which is hard for us old guys to read. Plus, since it is an image, nobody can easily search it to find where it talks about "hit point formulas".

You'll find that you'll get better help here if you ask focused questions, posting only the relevant parts of your code needed to illustrate your issue. The easier you make it for someone to help you, the more likely you are to get that help.

Having said all that...WHICH hit point calculation are you trying to do? at one point in the specs, it says HP should be (level * rand()%6 + 1). Elsewhere, it says HP should be calculated as 1d6 + [Con bonus] per level.

Which are you trying to do?



I am trying to do this one: "Elsewhere, it says HP should be calculated as 1d6 + [Con bonus] per level. "

The first few images were just for contexts sake. The actual task details are:


 
fred rosenberger
lowercase baba
Posts: 13048
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Kerry wrote:
I am trying to do this one: "Elsewhere, it says HP should be calculated as 1d6 + [Con bonus] per level. "


So images are hard to read, and are unsearchable. We would prefer it if you posted it as text, not any kind of image.

I don't see where you are adding the con bonus. All I see in your roll_hp method is you rolling the die once for each level.
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic