Because there is a very large sect of Python programmers who would burn you for using tabs over spaces.
And then there's the sect that have shit to do.
The pep8 convention for 4 space indentation is probably my biggest problem with Python, and people who deride others for using tabs is my biggest problem with the python community.
Python is like the odd man out, because you can't really "align" stuff in it the way you can with white space in other languages, which is ultimately the downside to using the "tab" byte. Some systems may use 8, some may use 4 or some odd number. Though if you can't align stuff with white space, it doesn't ultimately matter what style you use and it's just a hurgleburgle.
They can eat shit and die, basically.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
I met Tim O'Reilly. He gave me a twitter shout out too. We're totally best buds now.
I tried to shake him to see if some books would fall out, but it wasn't happening.
And Python tabs/spaces are a preference thing until you have to deal with a system that takes python functions as strings, then you're going to eat your fingers debugging. I mean shit like
"def func(self,x):\\n if x > 0:\\n return x"
yeah, fuck that shit
Starfuck on
jackfaces
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
I always used 2 spaces as tab when writing python code, screw anyone that complained.
Depending on what editor I'm using it jumps between 2 and 4, but it doesn't really matter to me in the end. I just hate the guys that go "abrlugbrlugbglgllllllll TABS SPACES I PROGRAM IN VARIABLE WIDTH FONTS LIKE A BOSS"
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
I love Python, but some of the constructs are absolutely the result of one guy convinced he knows knowing better than everyone else.
That's really not the case, GvR has shown himself to be incredibly welcoming to new ideas for Python, if anything some of Python's flaws are because he used to be too magpie in his addition of language features and other people's suggestions.
One the positive effects of this is that almost all of Python's 'functional' stuff, the lambda, list comprehensions, map and filter and reduce etc. where all from outside contributors and as GvR says pretty much were outside his area of expertise.
the functional stuff has been a godsend, but there are still quirks to Python (and mind you I love Python) that drive me absolutely insane.
That, however is true with any language. It's like X Window Managers, or Source control - pick the one that sucks the least for what you're trying to do, and use that. They all suck.
Quick bitch-fest: Xcode 4 was released today. Apple can go take a hike though. Xcode now costs money. You either have to enroll in the iOS Developer Program ($99), the Mac Developer Program ($99) or you can buy Xcode on the App Store ($5). $5 isn't a big deal at all, but why all the sudden start charging for Xcode? Let me guess: Sarbanes–Oxley?
Man that really sucks, well might I suggest QtCreator if you do any C++ development
if you're doing C++ development anywhere, I strongly suggest coupling it with QT. It greatly reduces the headaches associated with plain old C++ and the STL and Vectors...
Speaking of Python, I was commenting to a friend the other day that I was kind of surprised how slow the uptake of Python 3 has been. Python 3 was released in 2008, yet everyone I know is still using 2.6/2.7.
The change to the default behaviour of divide in python to always return a float value pissed me off greatly, and I expect it did the same for numerous other developers.
Why would that bother you? You can floor/ceil/round it if you want a flat integer, and since Python is dynamically typed, it seems more logical to return the most complex type possible and go down from there.
Python isn't dynamically typed, its "duck" typed. You may not have to declare it as a type, but you definitely need to massage it into a different type.
Well, they may be automatically moving all variable declarations to the beginning of the block they are defined in. Or to the point they are first used
That's still horrible. Now rather than giving the programmer a statically analyzed compile time error for a very obvious mistake, you've made him wait to actually test it, and then thrown a run-time error.
a lot of scripting languages create variables on use. bash, perl (unless you use strict).
The biggest problem is typo errors. They're a bitch to debug. (also one of the top 3 errors)
How important is it, in your opinion, to know design patterns? Is most of what you do based on an existing design pattern?
Design Patterns provide a common language to communicate common structures and implementations. If you're in a shop that uses them, learn the lingo and the imps. You don't need the gang of four book, you can just get them through wikipedia.
When using them, you don't decide on pattern first, you write functionality, and say - huh, this should be refactored into a $foo pattern. Then you refactor.
Yeah the only thing that really sticks out to me is a few name changes and syntax uniformity. I'd be pretty hesitant to convert all my existing code to 3.0. Of course that's a double edged sword because then I'd probably never upgrade my interpreter to 3.0 and all my new code would be 2.7 as well.
It basically surmounts to rewriting my code to accommodate the changes. Though that was a skim so I probably glossed over some deeper changes.
The way Python 3 handles Unicode has completely changed. It is the fundamental difference between 2 and 3 and it's one the the Python community grappled with for ages - seriously like a year of time just dedicated to how to encode strings. And it's one of those things where (if like me) you don't even think about Unicode at all in your day to day programming it makes not one jot of difference but (apparently) if you deal with Unicode as a matter of course the changes are wide ranging and highly significant.
As for upgrading/not upgrading code I think the idea is that you don't bother upgrading existing projects as Python is designed to have multiple interpreters and libraries sitting side by side without issues so there's no point in going through the pain if you don't have to.
Unicode sucks ass. I think there are like 4 different imps of it, and it is quite the pain in the ass in all forms.
I like the ASCII "\U######" method honestly. Seems like it'd be the most compatible and has the most extensibility. All this "#byte" memory positions and using an unsigned 64 bit int for the data. I'm sure the ASCII string is slower than fuck in comparison, but still, the rest of that shit is nonsense.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
I had a French keyboard I got in Quebec for a while and hoooly crap did that get annoying. Slightly different bracket placement can end up being really terrible.
I had a French keyboard I got in Quebec for a while and hoooly crap did that get annoying. Slightly different bracket placement can end up being really terrible.
Bilingual keyboards can die in a fire. Curse you Quebec!
I had a French keyboard I got in Quebec for a while and hoooly crap did that get annoying. Slightly different bracket placement can end up being really terrible.
Bilingual keyboards can die in a fire. Curse you Quebec!
For the longest time I was just like "no but, that would be so fucking awful. There's no way that's actually the setup here...."
But no! It was that bad. I eventually forced it to be just English and memorized key placement.
And Python tabs/spaces are a preference thing until you have to deal with a system that takes python functions as strings, then you're going to eat your fingers debugging. I mean shit like
"def func(self,x):\\n if x > 0:\\n return x"
yeah, fuck that shit
"def func(self,x):\\n\\tif x > 0:\\n\\treturn x"
Wait, what? Why would you do this? Single-line Python functions look horrific with either preference, abit slightly less horrific with spaces.
I've been working at my new job now for 9 weeks, inherted an app that was written pretty badly overall, and have been overhauling, and today we decided that we're going to rather casually not release the version I've been working on until we add in some more features.
This is awesome.
Because I've been subjected to insanity in previous jobs for the last 2+ years. Weekly release cycles, constant blitzkrieg patching...
Taking 3 extra weeks to perfect a moderate feature patch? Yes please.
Unless, of course, I am receiving some of that money. Then it suddenly becomes acceptable, even great.
There's actually a couple of pieces of coding-related software I'm interested in picking up once I graduate and have a job again. SublimeText is one, but I've also heard really good things about Beyond Compare, for merging code. I can't think of any others off the top of my head, but I'm sure there are some that either I have forgotten or I haven't encountered yet.
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
How important is it, in your opinion, to know design patterns? Is most of what you do based on an existing design pattern?
Design Patterns provide a common language to communicate common structures and implementations. If you're in a shop that uses them, learn the lingo and the imps. You don't need the gang of four book, you can just get them through wikipedia.
When using them, you don't decide on pattern first, you write functionality, and say - huh, this should be refactored into a $foo pattern. Then you refactor.
+1
Design patterns are incredibly important. As a junior level developer you should try to learn a lot of the common patterns and know what problems they solve. As a senior developer, you should understand their implementation because you'll often times need to know how to refactor a piece of code into a pattern.
That's not to say that patterns are the end all be all. You will need to know when to use a pattern, and when using that pattern is overkill.
The thing to remember is that if you are doing something moderately complicated, there are probably a lot of people that have already done it. Use what has already been proven to work.
remote data loading is basically the worst thing about iOS development and I must say, GCD and blocks are really awesome. It obliterates the shitty design patterns and boilerplate of implementing CFNetwork.
I finally forced myself to use it today and it's pretty much 70% less code.
i haven't tried to enter tabs
either way, if you forget a tab on a nest loop/function you'll be all barlargabahkhralkhralrh
I even forgot it in my example and so did you
"def func(self,x):\\n\\tif x > 0:\\n\\t\\treturn x"
It's funny too, because it's a python library that you have to send these funky python strings too. Every time I do this in Python, I cry a little.
Yes, it's quite prone to error. Which is why I asked why anyone would even do something like that to start with. Isn't the use of eval() generally frowned upon?
Can anyone help me out with some code for a game i'm making. Its kinda long but its a somewhat simple game (at least I think so). Basically, its a battle simulator/character building game that uses a text area as teh main means of displaying what is going on to the player. Here is the code first:
Main Class (brings up game screen)
import javax.swing.JFrame;
public class Main{
public static void main(String[] args){
gameworld go = new gameworld();
go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
go.setSize(400,300);
go.setVisible(true);
}
}
GameWorld (Real main screen. First prompts options boxes for name and class. Then brings up screen with text field, text area, and buttons)
import java.awt.*;
import java.awt.event.*;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.*;
import java.util.Random;
public class gameworld extends JFrame implements ActionListener{
private JTextField tf;
public JTextArea ta;
private final static String newline = "\n";
Random dice = new Random();
public int health;
int strength;
int speed;
int luck;
public gameworld(){
//OPENING MENY SYSTEM
super("Welcome to After World!");
setLayout(new FlowLayout());
String name = JOptionPane.showInputDialog(null,
"What is your name?",
"Enter your name",
JOptionPane.QUESTION_MESSAGE);
Object[] classes = {"Soldier: +5 to ATTACK", "Psycher: +5 to LUCK", "Scavenger: +4 to SPEED"};
String classchoice = (String)JOptionPane.showInputDialog(
getParent(),
"Select Your Class!\n"
+ "\n",
"Class Selection",
JOptionPane.DEFAULT_OPTION,
null,
classes,
"Soldier: +3 to ATTACK");
while(classchoice == null){
JOptionPane.showMessageDialog(getParent(), "You Must Choose a Class!");
classchoice = (String)JOptionPane.showInputDialog(
getParent(),
"Select Your Class!\n"
+ "\n",
"Class Selection",
JOptionPane.DEFAULT_OPTION,
null,
classes,
"Soldier: +3 to ATTACK");
}
if(classchoice == classes[0]){
strength = (1+dice.nextInt(10)) + 5;
speed = (5+dice.nextInt(10)) - 4;
luck = (1+dice.nextInt(10));
health = (1+dice.nextInt(10)) + 12;
classchoice = "Soldier";
}else if(classchoice == classes[1]){
strength = (4+dice.nextInt(10)) - 3;
speed = (2+dice.nextInt(10)) - 1;
luck = (1+dice.nextInt(10)) + 5;
health = (1+dice.nextInt(10)) + 5;
classchoice = "Psycher";
}else if(classchoice == classes[2]){
strength = (3+dice.nextInt(10)) - 2;
speed = (1+dice.nextInt(10)) + 4;
luck = (1+dice.nextInt(10));
health = (1+dice.nextInt(10)) + 8;
classchoice = "Scavenger";
}
//GAME WINDOW ELEMENTS
tf = new JTextField(30);
tf.addActionListener(this);
add(tf);
ta = new JTextArea("Welcome to After World " + name + " the " + classchoice + newline + newline + "Your Stats Are:" + newline + "Health: " + health + "Strength: " + strength + newline +
"Speed: " + speed + newline + "Luck: " + luck + newline, 13, 30);
ta.setEditable(false);
JScrollPane scrollPane = new JScrollPane(ta);
//Add Components to this panel.
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
add(ta, c);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1.0;
c.weighty = 1.0;
add(scrollPane, c);
//FIGHT BUTTON
JButton fight;
fight = new JButton("Fight");
add(fight);
//SEARCH BUTTON
JButton search;
search = new JButton("Search");
add(search);
//EXIT BUTTON
JButton exit;
exit = new JButton("Exit");
add(exit);
//HANDLER OBJECT FOR BUTTONS
fightbutton fighthandler = new fightbutton();
searchbutton searchhandler = new searchbutton();
exitbutton exithandler = new exitbutton();
fight.addActionListener(fighthandler);
search.addActionListener(searchhandler);
exit.addActionListener(exithandler);
//CASE FOR BUTTON SELECTED
}
public void actionPerformed(ActionEvent evt) {
String text = tf.getText();
ta.append(text + newline);
ta.selectAll();
//Make sure the new text is visible, even if there
//was a selection in the text area.
ta.setCaretPosition(ta.getDocument().getLength());
}
private class fightbutton extends fight implements ActionListener{
//functionality
public void actionPerformed(ActionEvent event){
ta.append("You have encountered a " + mname[encounter.nextInt(3)] + "\n" + "Do you want to fight it? (yes/no)" + "\n");
}
}
private class searchbutton implements ActionListener{
//functionality
public void actionPerformed(ActionEvent event){
}
}
private class exitbutton implements ActionListener{
//functionality
public void actionPerformed(ActionEvent event){
}
}
}
Fight Class (First of 3 action classes. Basically stores arrays for monsters and their stats. I want it to also automatically do a "battle" that automatically goes back and forth and tells the player if they won or lost)
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class fight {
Random encounter = new Random();
String mname[] = {"Squib Hopper", "Wild Dog", "Looter"};
int mstrength[] = {1, 3, 7};
int mspeed[] = {6, 4, 3};
int monster = encounter.nextInt(3) + 1;
}
The problem i'm having are trying to implement the fight class into the action listener of the fight button in the GameWorld class so when I write the code to go through the battle process it will appear in the text area and keep track of the players health. If anyone has other suggestions that I missed (i'm somewhat new with programming) it would really help.
If I'm reading this right you are implementing your game logic in the same class that displays the game? First thing I would do is probably separate that out, have your game logic in a separate class that your display has a reference to so it can call data from it. Well first thing I'd really do is capitalize your class names, kind of odd to read with them all lower case.
Once you have game logic moved away from your display, your display just has to worry about updating with the new data your game logic has, such as keeping track of player health, and making calls into the game logic to perform actions, like your Fight button.
Is there a book of best practices for game programming somewhere, or an online tutorial? A couple of friends and I are working on a 2d shooter in our spare time (in OCaml), and we're running headlong into a lot of questions that have to have been answered in the past. Working on things like collision detection, loading in level geometry, making that match up with the background, and so on feels like we're re-inventing the wheel constantly, and it would be nice to know if we've taken a good approach or not.
If I'm reading this right you are implementing your game logic in the same class that displays the game? First thing I would do is probably separate that out, have your game logic in a separate class that your display has a reference to so it can call data from it. Well first thing I'd really do is capitalize your class names, kind of odd to read with them all lower case.
Once you have game logic moved away from your display, your display just has to worry about updating with the new data your game logic has, such as keeping track of player health, and making calls into the game logic to perform actions, like your Fight button.
That's where I would start at least.
Could you highlight the display code for me, I thought I had seperated it with the Main class. Sorry to ask this but I really am fairly new to programming (only been learning for about 3-4 months).
If I'm reading this right you are implementing your game logic in the same class that displays the game? First thing I would do is probably separate that out, have your game logic in a separate class that your display has a reference to so it can call data from it. Well first thing I'd really do is capitalize your class names, kind of odd to read with them all lower case.
Once you have game logic moved away from your display, your display just has to worry about updating with the new data your game logic has, such as keeping track of player health, and making calls into the game logic to perform actions, like your Fight button.
That's where I would start at least.
Could you highlight the display code for me, I thought I had seperated it with the Main class. Sorry to ask this but I really am fairly new to programming (only been learning for about 3-4 months).
The only thing that should be in your JFrame class are display items. Have another class that holds things like Strength, Luck, Intelligence. The JFrame will get the character class from the user, then tell the Character.java class that he's a Fighter. In that constructor put in the stat initialization.
If the JFrame needs to update the display, it would do something liek character.getHealth() or something like that and add it to a Label for instance.
Also, as a design suggestion, you have a random in the class' base stats. That means one soldier I create could be weaker then one I create before that. That means people will keep starting new characters till that Random() gives you the max Integer of stats they're interested in. I would keep the base stats of your class static.
Exactly what DrunkMc said, you are setting up your UI in the GameWorld class, the JTextArea and JButtons and such, as well as having important internal stats about the state of your game in there, those often work best separated out to their own class or classes. Basically a game engine that the display has access to.
So with that, when you, for example, ask for a class choice and a choice is made, a call goes back to your game engine to set a class and the associated stats. When your display wants to say what the class is in your next bit of text, it makes a call back to the game engine to get that information, as well as the health, strength, speed and luck values.
Hopefully that helps make more sense of it. Don't worry about asking questions, learning programming can be difficult but jumping in head first and asking questions when you get stuck is a great start.
Posts
Can it be about how great Python is? We can indent the sections and everything.
I'm hesitant.
Because there is a very large sect of Python programmers who would burn you for using tabs over spaces.
And then there's the sect that have shit to do.
The pep8 convention for 4 space indentation is probably my biggest problem with Python, and people who deride others for using tabs is my biggest problem with the python community.
They can eat shit and die, basically.
I tried to shake him to see if some books would fall out, but it wasn't happening.
And Python tabs/spaces are a preference thing until you have to deal with a system that takes python functions as strings, then you're going to eat your fingers debugging. I mean shit like
"def func(self,x):\\n if x > 0:\\n return x"
yeah, fuck that shit
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
Depending on what editor I'm using it jumps between 2 and 4, but it doesn't really matter to me in the end. I just hate the guys that go "abrlugbrlugbglgllllllll TABS SPACES I PROGRAM IN VARIABLE WIDTH FONTS LIKE A BOSS"
the functional stuff has been a godsend, but there are still quirks to Python (and mind you I love Python) that drive me absolutely insane.
That, however is true with any language. It's like X Window Managers, or Source control - pick the one that sucks the least for what you're trying to do, and use that. They all suck.
Joe's Stream.
if you're doing C++ development anywhere, I strongly suggest coupling it with QT. It greatly reduces the headaches associated with plain old C++ and the STL and Vectors...
Joe's Stream.
Python isn't dynamically typed, its "duck" typed. You may not have to declare it as a type, but you definitely need to massage it into a different type.
Joe's Stream.
wha?
edit: duh. my brain interpreted "being Ruby 1.9" as "requiring Ruby 1.9". Never mind.
(Yes, that computer is named Cortana. But only because I ran out of Marathon AIs.)
a lot of scripting languages create variables on use. bash, perl (unless you use strict).
The biggest problem is typo errors. They're a bitch to debug. (also one of the top 3 errors)
Joe's Stream.
Design Patterns provide a common language to communicate common structures and implementations. If you're in a shop that uses them, learn the lingo and the imps. You don't need the gang of four book, you can just get them through wikipedia.
When using them, you don't decide on pattern first, you write functionality, and say - huh, this should be refactored into a $foo pattern. Then you refactor.
Joe's Stream.
Unicode sucks ass. I think there are like 4 different imps of it, and it is quite the pain in the ass in all forms.
Joe's Stream.
Random rant: goddamn the Swedish keyboard layout is ass for programming.
Swedish has 29 characters in the alphabet. Å is to the left of P, Ö and Ä to the left of L.
On my Macbook, I hit alt-7 for pipe, alt-shift-7 for a backslash. Alt 8-9 for square brackets, Shift-alt 8-9 for curly brackets.
Luckily I do most of my work in Ruby right now, so I don't need brackets all that often. If I did I'd just switch to English layout while coding.
True story, back in the year 2000 if you had you windows language setting set to Swedish you couldn't compile COM objects in Visual Studio.
I made a game, it has penguins in it. It's pay what you like on Gumroad.
Currently Ebaying Nothing at all but I might do in the future.
For the longest time I was just like "no but, that would be so fucking awful. There's no way that's actually the setup here...."
But no! It was that bad. I eventually forced it to be just English and memorized key placement.
http://www.sublimetext.com/2
My first 5 minutes with it were quite enjoyable
I very much like it, but it costs money (or it annoys you ever 5 saves or so), which is kind of lame.
I do like double pane editing, though, on a widescreen monitor it's excellent.
most things in fact cost money
"def func(self,x):\\n\\tif x > 0:\\n\\treturn x"
Wait, what? Why would you do this? Single-line Python functions look horrific with either preference, abit slightly less horrific with spaces.
either way, if you forget a tab on a nest loop/function you'll be all barlargabahkhralkhralrh
I even forgot it in my example and so did you
"def func(self,x):\\n\\tif x > 0:\\n\\t\\treturn x"
It's funny too, because it's a python library that you have to send these funky python strings too. Every time I do this in Python, I cry a little.
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
This is awesome.
Because I've been subjected to insanity in previous jobs for the last 2+ years. Weekly release cycles, constant blitzkrieg patching...
Taking 3 extra weeks to perfect a moderate feature patch? Yes please.
There's also Kod which is open source, but it's pre-alpha and essentially feature-less at the moment. Keeping an eye on it though.
Which is lame.
Unless, of course, I am receiving some of that money. Then it suddenly becomes acceptable, even great.
There's actually a couple of pieces of coding-related software I'm interested in picking up once I graduate and have a job again. SublimeText is one, but I've also heard really good things about Beyond Compare, for merging code. I can't think of any others off the top of my head, but I'm sure there are some that either I have forgotten or I haven't encountered yet.
I've got MingGW-w64, but no one seems to have any consistent views on how to setup 64-bit MSYS so it actually works.
+1
Design patterns are incredibly important. As a junior level developer you should try to learn a lot of the common patterns and know what problems they solve. As a senior developer, you should understand their implementation because you'll often times need to know how to refactor a piece of code into a pattern.
That's not to say that patterns are the end all be all. You will need to know when to use a pattern, and when using that pattern is overkill.
The thing to remember is that if you are doing something moderately complicated, there are probably a lot of people that have already done it. Use what has already been proven to work.
I finally forced myself to use it today and it's pretty much 70% less code.
Yes, it's quite prone to error. Which is why I asked why anyone would even do something like that to start with. Isn't the use of eval() generally frowned upon?
:^: :^:
Main Class (brings up game screen)
GameWorld (Real main screen. First prompts options boxes for name and class. Then brings up screen with text field, text area, and buttons)
Fight Class (First of 3 action classes. Basically stores arrays for monsters and their stats. I want it to also automatically do a "battle" that automatically goes back and forth and tells the player if they won or lost)
The problem i'm having are trying to implement the fight class into the action listener of the fight button in the GameWorld class so when I write the code to go through the battle process it will appear in the text area and keep track of the players health. If anyone has other suggestions that I missed (i'm somewhat new with programming) it would really help.
Once you have game logic moved away from your display, your display just has to worry about updating with the new data your game logic has, such as keeping track of player health, and making calls into the game logic to perform actions, like your Fight button.
That's where I would start at least.
Could you highlight the display code for me, I thought I had seperated it with the Main class. Sorry to ask this but I really am fairly new to programming (only been learning for about 3-4 months).
The only thing that should be in your JFrame class are display items. Have another class that holds things like Strength, Luck, Intelligence. The JFrame will get the character class from the user, then tell the Character.java class that he's a Fighter. In that constructor put in the stat initialization.
If the JFrame needs to update the display, it would do something liek character.getHealth() or something like that and add it to a Label for instance.
Also, as a design suggestion, you have a random in the class' base stats. That means one soldier I create could be weaker then one I create before that. That means people will keep starting new characters till that Random() gives you the max Integer of stats they're interested in. I would keep the base stats of your class static.
So with that, when you, for example, ask for a class choice and a choice is made, a call goes back to your game engine to set a class and the associated stats. When your display wants to say what the class is in your next bit of text, it makes a call back to the game engine to get that information, as well as the health, strength, speed and luck values.
Hopefully that helps make more sense of it. Don't worry about asking questions, learning programming can be difficult but jumping in head first and asking questions when you get stuck is a great start.