Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What programming topic would you want the next challenge to be about?  (It might be a good opportunity to focus on a subject you're not familiar with or to reinforce knowledge on one that you already know)

Control Flow
- 2 (2.2%)
Arrays, Strings, Pointers, and References
- 8 (9%)
Functions
- 4 (4.5%)
Basic object-oriented programming
- 30 (33.7%)
A bit more advanced OOP (Composition, Operator overloading, Inheritance, Virtual Functions)
- 18 (20.2%)
Templates
- 8 (9%)
Other (Explain)
- 4 (4.5%)
Working with files?  (Streams)
- 15 (16.9%)

Total Members Voted: 89


Pages: 1 ... 68 69 [70] 71 72 ... 78

Author Topic: Programming Challenges & Resources (#bay12prog) Initiative  (Read 95698 times)

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1035 on: March 11, 2011, 12:39:08 pm »

Code: [Select]
double add(double x, double y){
return x+y;}

double subtract(double x, double y){
return x+y;}
Careful when you copy code.  :P
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

malimbar04

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1036 on: March 11, 2011, 01:07:20 pm »

:O

I didn't see that, thanks for that as well.

The funny thing is that I didn't copy, but just typed the wrong character on one of them.
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1037 on: March 11, 2011, 01:33:08 pm »

:O

I didn't see that, thanks for that as well.

The funny thing is that I didn't copy, but just typed the wrong character on one of them.
Clones, clones in yo head!
Logged

Oscuro1987

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1038 on: March 11, 2011, 03:30:25 pm »

Umm I don't know if it's appropriate to post it here, but thanks for this article, it's highly useful and nice. :)
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1039 on: March 11, 2011, 04:39:57 pm »

Umm I don't know if it's appropriate to post it here, but thanks for this article, it's highly useful and nice. :)
Wow, that post said so little that I actually went ahead and checked your post history if you were a spambot.  ;)
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Oscuro1987

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1040 on: March 11, 2011, 04:52:31 pm »

Umm I don't know if it's appropriate to post it here, but thanks for this article, it's highly useful and nice. :)
Wow, that post said so little that I actually went ahead and checked your post history if you were a spambot.  ;)
It's not quantity that matters, it's quality. ;)
Logged

olemars

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1041 on: March 11, 2011, 04:58:30 pm »

Umm I don't know if it's appropriate to post it here, but thanks for this article, it's highly useful and nice. :)
Wow, that post said so little that I actually went ahead and checked your post history if you were a spambot.  ;)

I did too. Suspicions lingered until post 7 or so.
Logged

forsaken1111

  • Bay Watcher
    • View Profile
    • TTB Twitch
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1042 on: March 12, 2011, 02:00:15 am »

forsaken1111: I am several hours late for bed, so I cant go very deep. but that looks like a relatively simple problem in numeric linear algebra and can I believe it can be solved with relatively simple matrix transformations.
Did you (or anyone else) ever make any progress on this?
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1043 on: March 12, 2011, 04:05:13 pm »

Umm I don't know if it's appropriate to post it here, but thanks for this article, it's highly useful and nice. :)

No idea which article you mean but I'm fairly sure it's okay to post to say thanks to whoever is was.

At somepoint we should really go through this thread and collect all the article links people have posted, I know Alexhans was doing that but I've not seen him post here in a while.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1044 on: March 12, 2011, 04:21:28 pm »

Yes, I've been planning on collecting everything that's been posted here and updating the first page for some time now.  I thought you'd have created a new thread by now but, who would've known.

I'll just do it.

Collaboration is welcome.  I'll open a couple of pads and modify the post from there so, if I miss anything people can modify things before I paste them in b12.
http://piratepad.net/hmteJdYS5e  (Forum Page 1)
http://piratepad.net/uINerGOUTF (Forum Page 2)

EDIT:  Ugh... I'm lagging horribly.  There's some interesting discussions in this thread but I'm not sure if I should link to any specific post.  If you have suggestions, do tell.
« Last Edit: March 12, 2011, 04:49:34 pm by Alexhans »
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1045 on: March 13, 2011, 11:58:00 am »

How do I free l->next?
Code: [Select]
void rem_after (LIST *l) /* remove the node after 'l' */
{
     l->next = l->next->next;
}
Doing this gives a glibc error at runtime:
Code: [Select]
void rem_after (LIST *l) /* remove the node after 'l' */
{
     LIST *f = l->next;
     l->next = l->next->next;
     free(f);
}

...

$./bin
*** glibc detected *** ./bin: free(): invalid pointer: 0xbff49a60 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6b8d1)[0xb76b08d1]
/lib/libc.so.6(+0x6d1e6)[0xb76b21e6]
/lib/libc.so.6(cfree+0x6d)[0xb76b534d]
./bin[0x80486b1]
/lib/libc.so.6(__libc_start_main+0xe6)[0xb765bbb6]
./bin[0x8048451]
======= Memory map: ========
08048000-08049000 r-xp 00000000 08:03 2588995    /home/ron/code/c/libs/bin
08049000-0804a000 r--p 00000000 08:03 2588995    /home/ron/code/c/libs/bin
0804a000-0804b000 rw-p 00001000 08:03 2588995    /home/ron/code/c/libs/bin
0858b000-085ac000 rw-p 00000000 00:00 0          [heap]
b7610000-b762b000 r-xp 00000000 08:03 5237437    /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
b762b000-b762c000 r--p 0001a000 08:03 5237437    /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
b762c000-b762d000 rw-p 0001b000 08:03 5237437    /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
b7644000-b7645000 rw-p 00000000 00:00 0
b7645000-b7788000 r-xp 00000000 08:03 5139001    /lib/libc-2.11.3.so
b7788000-b778a000 r--p 00143000 08:03 5139001    /lib/libc-2.11.3.so
b778a000-b778b000 rw-p 00145000 08:03 5139001    /lib/libc-2.11.3.so
b778b000-b778e000 rw-p 00000000 00:00 0
b778e000-b77b1000 r-xp 00000000 08:03 5139014    /lib/libm-2.11.3.so
b77b1000-b77b2000 r--p 00022000 08:03 5139014    /lib/libm-2.11.3.so
b77b2000-b77b3000 rw-p 00023000 08:03 5139014    /lib/libm-2.11.3.so
b77c9000-b77cb000 rw-p 00000000 00:00 0
b77cb000-b77cc000 r-xp 00000000 00:00 0          [vdso]
b77cc000-b77e8000 r-xp 00000000 08:03 5138831    /lib/ld-2.11.3.so
b77e8000-b77e9000 r--p 0001b000 08:03 5138831    /lib/ld-2.11.3.so
b77e9000-b77ea000 rw-p 0001c000 08:03 5138831    /lib/ld-2.11.3.so
bff2b000-bff4c000 rw-p 00000000 00:00 0          [stack]
Aborted
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1046 on: March 13, 2011, 02:29:20 pm »

How long is the list?
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1047 on: March 13, 2011, 02:51:05 pm »

It varies from place to place I guess. Here's the list definition:
Code: [Select]
typedef struct __Node {
     int data;
     struct __Node *next;
} _Node;

#define STACK _Node
#define LIST  _Node
Logged

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1048 on: March 14, 2011, 04:30:10 am »

So what happens to a list exactly one unit long?
Logged

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #1049 on: March 14, 2011, 06:33:03 am »

Alright, I'm totally stumped, been at this for hours.

I'm on Python 2.41.

What I'm trying to do: I've set it up so players enter a name for their character. I want these custom names to then be used as the names of classes that hold all their character data. (Creating unique player instances from a racial class file.) This way I can export the class as a file using the character names and not some generic file name I have to assign to it.

My problem: I cannot find a way to have a variable be used as a class name (or be read as input for a lot of other things.) I first create a function with raw_input, and assign the returned raw input a variable name. But when I try to do:

Name_Variable = Human() (which is an instance of the class "Creature")

I get a class named Name_Variable instead of, say, Trogdor. (The name the player entered.) 

I know the function is properly returning the value to 'Name_Variable', because everywhere else within the code it correctly reports its value.

I obviously still don't get some fundamental logic of Python, or even if I'm trying to create the right data structure for my goals, but my questions are:

How do I create a class whose name is generated from player input? Can variables not be used at all for class names?
« Last Edit: March 14, 2011, 06:59:03 am by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti
Pages: 1 ... 68 69 [70] 71 72 ... 78