Results 181 to 210 of 356
Thread: ProgrammersitP
-
2013-01-10, 09:31 AM (ISO 8601)
- Join Date
- Mar 2010
- Location
- Gridania, Eorzea
- Gender
Re: ProgrammersitP
If you haven't found it, or had it suggested yet, definitely check out wine for getting games to run in Linux. Some games take a lot of effort with all the extra bits you have to do to get them to run properly, but for the most part it greatly increases the number of games you can get to run in Linux without too much hassle.
As for python, I find it to be a very fun language to use, and very straight forward. I'm still learning it myself, but compared to what I do know (C++ and some C) it seems less messy, at least syntacticly. For instance:
SpoilerPython:
print "Hello world!"
C:
#include<stdio.h>
int main(void)
{
printf("Hello World!");
}
It does get a bit interesting when you try to turn python files into .exe but there's oodles of online resources for python. Also depending on what you want to do with python, I know a number of good tutorial sites if you're interested (everything from an in browser compiler to how to program a rougelike).
-
2013-01-10, 09:45 AM (ISO 8601)
- Join Date
- Sep 2008
- Location
- UK
- Gender
-
2013-01-10, 10:17 AM (ISO 8601)
- Join Date
- Nov 2009
- Location
- Germany
- Gender
Re: ProgrammersitP
You mean like this?
Code:String test="a*b-c/d"; String[] split = test.split("[a-zA-Z0-9]"); int ctr=0; for(String s:split){ System.out.println("operator "+(++ctr)+": "+s); }
Same is true if your variables are more than one char long. So "way/time=speed".split("[a-zA-Z0-9]"); would result in
operator 1:
operator 2:
operator 3:
operator 4: /
operator 5:
operator 6:
operator 7:
operator 8: =
A better way to do this would to first split the text into blocks of brackets recursive until no brackets exist. So
"(1+a)*(10/(-b+2))" would become ["1+a",["10/","-b+2"]]
When you have found an text without brackets split this into blocks of plus or minus (recursive, until no plus or minus exists) and replace every empty element with 0.
So you now got:
[["1","a"],[["10/"],["0","b","2"]]]
now you replace all variables (for example with 2 and 3) and use the operators of the deepest level (that's because you should do this recursivly) so 0-3+2= -1
You replace this level and get:
[["1","a"],["10/","-1"]]
Now you calculate those next levels. So 10/-1 is minus 10 and 1+2 is 3.
You get ["3","-10"] and calculate this with the operator "*". The solution is -30.Last edited by Leolo; 2013-01-10 at 10:49 AM.
-
2013-01-10, 10:46 AM (ISO 8601)
- Join Date
- Mar 2009
- Location
- Sweden
- Gender
Re: ProgrammersitP
Given, both #include and main are lines that'll take up less than a percent of any larger project, and the added parantheses are just as much of a hassle as the indentation rules for Python, i.e. no a lot.
Also, unlike C, Python was developed as a scripting language, and sacrifices large scale performance for lower developement times.Clouddreamer Teddy by me, high above the world, far beyond its matters...
Spoiler: Banner by Vrythas
-
2013-01-10, 10:52 AM (ISO 8601)
- Join Date
- Mar 2010
- Location
- Gridania, Eorzea
- Gender
Re: ProgrammersitP
In Browser Tutorial
How to make a Roguelike (WARNING: site also contains a rather comprehensive list of all roguelikes)
Two books on making games with python and pygame
Pygame homepage (also has links to how tos)
The obligatory everything python
As for actual books, I'm not sure of what to get. Once I can get to my jump drive though I do have a number of ebooks that might be useful, I'll post the names once I find them.
-
2013-01-10, 12:03 PM (ISO 8601)
- Join Date
- Jan 2012
Re: ProgrammersitP
How about these for starters? *
Think Python
The Python Game Book
*Full disclosure: I don't actually know Python. I'm merely regurgitating suggestions made in another thread; I think Rawhide suggested one of them too.
-
2013-01-10, 12:11 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
If you're looking to do Linux programming, you should consider looking at C/C++ as well. Most of the Linux kernel is written in C, though I hear the ancient Linux Wizards (Torvalds and the like) wrote in straight Assembly...
As a language, I love Python. It's excellent for its simplicity, both to pick up and use. Python is an interpreted language (so, everything evaluated in sequence at runtime), and Python is frequently called a scripting language. Some more complex packages will automagically compile your Python files (*.py) into bytecode files (*.pyc), which are wholly unintelligible to your text editor, but run much faster.
Someone keeps telling me there's a library out there that can (re)compile Python code that executes faster than a C program equivalent. PyPy I think? I haven't personally tried it, but compilation does exist... in a way (outside of compiling to Bytecode, similar to Java).
Since this is Linux, Python should be installed by default into /usr/bin/pythonXY or something along those lines, and should be accessible on the default environment variables path (e.g. type "python" in your shell and a python interpreter should appear). If for some reason it isn't, you'll have to go looking for it ('which python') and then add it to your environment variables.
P on the LAMP stack is typically PHP, yes (or Perl). I don't think The Succubus explicitly mentioned web servers though (correct me if I'm wrong).
The most common Python install is probably CPython (obviously built on C), though other versions exist.
Python ships with the IDLE editor, though I wouldn't go so far as to say it's an IDE.
Sublime Text is an excellent editor, and is cross platform. Or you could join the raging debate between Vim and Emacs users...
1
Succubus, what sort of Python programming are you looking to do exactly?Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2013-01-10, 12:19 PM (ISO 8601)
- Join Date
- Mar 2010
- Location
- Gridania, Eorzea
- Gender
-
2013-01-10, 12:35 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Notepad++ is Windows only (and as we're looking at Linux development...).
Now, Notepad++ does run in WINE, but running it in WINE is one of the most frustrating experiences I have ever had with software running in WINE. Making a small edit to the file outside of Notepad++ while the file is still open in Notepad++? NOPE! Boom! It throws a fit, and either closes the file or kicks you to the desktop before crashing and burning in a horrible fit.
And no, this had nothing to do with any other software on the machine or installation incompetence on my part (at least, I'd hope not), as it was a fresh out of the box OpenSUSE install, and the only thing I'd done up to that point was 'sudo zypper install wine' before downloading the Windows install binary. Something along those lines anyways... WINE might have been installed already. Anyways...
Edit: as for the Vim vs. Emacs debate, it is necessary to link the relevant xkcd strip.
You might also be interested in Wikipedia's article, and what the folks over at Stack Exchange have to say.Last edited by Neftren; 2013-01-10 at 12:46 PM.
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2013-01-10, 01:33 PM (ISO 8601)
- Join Date
- Mar 2010
- Location
- Gridania, Eorzea
- Gender
Re: ProgrammersitP
-
2013-01-10, 02:05 PM (ISO 8601)
- Join Date
- Mar 2009
- Location
- Sweden
- Gender
Re: ProgrammersitP
Well, from what I've understood, Java programs may execute mariginally faster than their C equivalents, so it's not outside the realm of possibility for compiled Python as well...
More like a plain text editor with some fancy colours and semi-automatic indentation.Clouddreamer Teddy by me, high above the world, far beyond its matters...
Spoiler: Banner by Vrythas
-
2013-01-10, 02:15 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Last edited by Neftren; 2013-01-10 at 02:15 PM.
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2013-01-10, 05:34 PM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: ProgrammersitP
-
2013-01-10, 10:24 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
In hindsight, I was kind of an idiot about the whole thing. I wasn't really satisfied with the stuff already on the machine, and I didn't really like the look and feel of a lot of existing editors. I spend most of my time working in OSX, where desktop applications have excellent look and feel--the same cannot be said of "Free Software" on Linux. Nothing I found could really compare to Xcode and Dashcode. Since those are unavailable in Linux, I turned to Notepad++ since it was the next most familiar thing, and it does run in WINE (albeit poorly, as I later discovered).
Then I stumbled on Sublime Text and have never looked back. It really knocks the park out of literally every other editor or IDE I've used, with the exception of Xcode for C/C++ development (or developing C/C++ and Python in parallel), and Visual Studio for working on Microsoft stuff.Last edited by Neftren; 2013-01-10 at 10:24 PM.
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2013-01-11, 09:33 AM (ISO 8601)
- Join Date
- Oct 2009
-
2013-01-22, 12:02 AM (ISO 8601)
- Join Date
- Feb 2010
- Location
- Calgary
- Gender
Re: ProgrammersitP
This new computer science course is going to drive me nuts I think. It has nothing to do with it being in java, or any of the logic, or anything like that. It has to do with getting help and citing sources. Now don't get me wrong, I have no problem with citing sources, but it seems to be going overboard.
For example, our prof today should an example of code for reading a file. with a
do
{
a bunch of stuff
}
while(filepointer != null)
The thing is I have been programming on and off for over 25 years. A little for work, but mostly on my own. something like that is standard, yet if I do something like it in my code, if I don't say in the documentation
*this code from prof joe blow from cpsc course on jan 22*
i would get 0% and maybe kicked out of the course for cheating.
On top of that if I am having problems and seek help I can't post/show/say any of my code to any one (except prof and TA) or again I risk getting kicked out for cheating because another student might see/hear my code.
-
2013-01-22, 06:40 PM (ISO 8601)
- Join Date
- Oct 2009
Re: ProgrammersitP
Thats seems extremely arbitrary (especially for simple stuff like a filereader) ^^
Well I guess he doesn´t want you guys to copy paste most of your code (which can lead to working programs especially if they are not too complex)
but wants you to really understand what you are doing, ie reading a sample code explaining how to solve problem xyz and then writing the thing.
How he will ever be able to enforce it though is beyond me especially with nice little things like refactor renameLast edited by Emmerask; 2013-01-22 at 06:43 PM.
-
2013-01-23, 05:44 AM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
Thank you.
I don`t get why people are so obssesed with speed of execution. Even if C code is 3 times faster then Java, most things will still run faster then a blink of an eye. It would only matter in programs that realy take a lot from the computer. Besides, there are other factors to consider (Java is cross platform, for exemple).
In another issue, I decided to start programming for Android, using Java. How relevent is Java ME to Android development? Any resources you can recommend to me? Any tips?Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.
-
2013-01-23, 06:23 AM (ISO 8601)
- Join Date
- Oct 2009
Re: ProgrammersitP
Its a pretty simple step from java me to android
though a few things differ greatly:
1)ui library is more extensive and more complicated
2)only one ui thread
3)you have to be much more careful with threads and thread safety
4)limited resources (due to deployment on a phone)
5)no extensive database stuff, sqlite must suffice
6)xml and json are pretty important ^^
this video list might help you:
http://www.youtube.com/view_play_lis...6D322B5E2764CF
and of course there is:
http://stackoverflow.com which is also the official help platform
Another tip would be use Intellij instead of other ides it really makes life more easy
http://www.jetbrains.com/idea/Last edited by Emmerask; 2013-01-23 at 06:25 AM.
-
2013-01-23, 06:49 AM (ISO 8601)
- Join Date
- Sep 2008
- Location
- UK
- Gender
Re: ProgrammersitP
How do folks like my avatar for Basic Avatar Week? Didn't really have enough space to do Visual Basic.
As for what I'm looking to do in Python, probably a similar thing to shell scripting I guess. As mentioned above, I'm learning about Linux at the moment and it'd be cool if I could build a "toolkit" to do basic automated tasks with.
Plus a language to write simple games in would be nice. I recall stuff like Laser Squad and Lords of Chaos from my CPC days and it'd be cool if I could write something like that.
-
2013-01-23, 07:48 AM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.
-
2013-01-23, 01:52 PM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: ProgrammersitP
If you're thinking about Java then they do more than simple games in it--Minecraft is written in Java, for example. I believe it makes use of a thing called the Lightweight Java Game Library to provide 3D capabilities and the like:
http://lwjgl.org/
-
2013-01-23, 03:06 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Hmm... shell scripting is probably best done with shell scripting. Might want to look into the bash reference manual for that.
If you're looking to invoke command line utilities and so on, you should consider C, or perhaps C++ depending on what you're looking to do.
Simple games programming ... as slow as it is, try pygame.Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2013-01-23, 03:13 PM (ISO 8601)
- Join Date
- Jan 2010
- Location
- Myrtle Beach, SC
- Gender
Re: ProgrammersitP
He probably doesn't mean actual shell scripting. Scripting in the bash shell can be horribly mind-wrecking. It's probably best to avoid it. Python is definitely a decent language to get into, and has a pretty low barrier to entry.
CEO of Evil Incorporated: "Subjugating humanity for a better tomorrow."
-
2013-01-23, 07:53 PM (ISO 8601)
- Join Date
- Feb 2010
- Location
- Calgary
- Gender
Re: ProgrammersitP
I am new to java and oop so this may sound like a stupid question.
I create a file called Guess.java.
In it I include import statements first. Then create a class called Game and the have the Guess class. so it looks like this
Code:import java.stuff import java.morestuff public class Game { stuff public void getstuff() { more stuff } ..... } public class Guess { public static void main(String[] args) { stufff Game.getstuff(); Game.STUFF(); more stuff .... } }
Code:public class Guess { public class Game { stuff } public static void main(Strings[] args) { Game.stuff } }
-
2013-01-24, 07:18 AM (ISO 8601)
- Join Date
- Mar 2009
- Location
- Sweden
- Gender
Re: ProgrammersitP
Yes, you should be able to put the Game class inside Guess, but no matter what you do, each compiled class is going to end up in its own .class file due to the way Java works (Guess.class and Game$Guess.class (at least I think it was an $)). Are you not allowed to have more than one compiled java file, or does the restriction only affect the source file (.java)?
Clouddreamer Teddy by me, high above the world, far beyond its matters...
Spoiler: Banner by Vrythas
-
2013-01-25, 02:36 AM (ISO 8601)
- Join Date
- Nov 2011
- Location
- the crisper drawer
Re: ProgrammersitP
I've started learning Python fairly recently with the end goal of creating a (relatively) simple computer game.
I've got most of the basics done, so far—character selection, saving and loading games, etc. But the lack of a GUI is driving me crazy on some fundamental level. And I have a niggling worry that I'll finish the game only to discover that I have to start from scratch because I didn't design my code around the GUI. So I'd like to work on the game logic + GUI simultaneously.
My problem is trying to find the right combo of language and GUI framework. And I guess the former should take precedence over the latter, so these are the main four I've been looking at:
- Python: I have a working knowledge of it already, but there seems to be a surprising lack of coherent documentation. I understand that programming is jargon-y by nature, but it feels almost as if the people who write the documentation go out of their way to be exclusive of beginners. Plus there's the whole 2.7/3.x divide that makes the right documentation even harder to find. And a lot of the GUI frameworks for Python seem to be dead projects (e.g. Pygame?).
- C++: I've heard this is a really good language to know all-around, but I've also heard that it's much more confusing than Python, and much harder to read. And I don't really understand its strengths and weaknesses compared to, say, Python. But it seems to be infinitely better documented.
- C#: Windows-only, I think? So I'd rather use something else.
- Java: I'm trying to avoid Java, since I've been told that it's going the way of the dinosaur (perhaps even more quickly due to the recent security problems).
I don't think there's an engine for the type of game I'm writing (sort of stat-based strategy, strongly text-based), so I'm looking for a framework for now.
Ideally I'd like something cross-platform. I don't need anything complicated as far as GUI—text, buttons, forms, photos, and that's it. But I have no idea what sort of technical features I'm supposed to be looking for in a framework.
TL;DR version: For programming a simple(ish) game, is it worth learning a language other than Python in order to have better documentation and GUI frameworks? And what framework should I use?
ETA: And I've tried TKinter for Python, and it seemed pretty awful. And I've heard people say it's awful compared to a lot of frameworks.Last edited by Inglenook; 2013-01-25 at 02:37 AM.
-
2013-01-25, 03:01 AM (ISO 8601)
- Join Date
- Oct 2007
- Location
- Germany, NRW
- Gender
Re: ProgrammersitP
Well there are actually several python game engines/frameworks apart from pygame. You might want to look at cocos2D (There is also a version made for iOS but that's a different engine.)
For 3D games there is Panda3D, but that is probably overkill for your project anyway.
The engine I have the most experience with is Ren'Py which is based on pygame. It's build for visual novels, but pretty flexible.
If you only need a traditional GUI framework instead of a game framework you could try wxpython. It's pretty much the most popular GUI framework at the moment. I find the documentation a bit lacking at times though.
-
2013-01-25, 03:06 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: ProgrammersitP
Visual BASIC aside, you should never write your back-end code in such a way that the GUI has to be a certain way for it to work, because it makes it a pain to change if you decide the GUI isn't right. Have the two things as separate codebases with a strictly defined way of talking to each other!
-
2013-01-25, 10:50 AM (ISO 8601)
- Join Date
- May 2009
Re: ProgrammersitP
How important is the platform-independence to you? I admittedly haven't used it much, but C# with .NET seems rather nice. It's easy to pick up from Java or other C-like languages, and it seems pretty easy to code GUIs, especially if you have access to Visual Studio.