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 ... 10 11 [12] 13 14 ... 78

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

Normandy

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #165 on: June 19, 2010, 09:53:10 pm »

1. Probably just to make things clearer - i.e. not everyone immediately recognizes that a char can be represented by its ASCII code. Not sure though, but that's just my guess.

2. The error is because that char is signed; a value like 0xCD (which is 205) would fit into an unsigned char (range 0 to 255), but it is truncated because in this case the char is signed (range -128 to 127). The thing is that this sort of thing is a compiler option - some compilers default to signed chars, while others default to unsigned chars.

3. I hope not.
Logged

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #166 on: June 20, 2010, 01:11:54 am »

3. it (prob) will if you use key value bigger then 255.
Logged

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #167 on: June 20, 2010, 06:39:11 am »

Thanks for the input Blacken, much appreciated!
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

ed boy

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #168 on: June 20, 2010, 12:33:14 pm »

If I might suggest a challenge:

Make a program to play tic tac toe. I recently did this to help me learn fortran, and I can say it's been a very helpful exercise.
Logged

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #169 on: June 20, 2010, 12:46:08 pm »

Awesome, thanks!
Logged

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #170 on: June 20, 2010, 08:23:40 pm »

If I might suggest a challenge:

Make a program to play tic tac toe. I recently did this to help me learn fortran, and I can say it's been a very helpful exercise.

For anyone that does this if your AI can be beaten, it can still be improved.  I may dig up my Tic-Tac-Toe program later and post it, if anyone wants an example.  Probably just as the .exe at first, so people still have to figure it out on their own.
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

Org

  • Bay Watcher
  • Daring Hero
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #171 on: June 20, 2010, 10:26:46 pm »

So hey guys.
Org wants to learn more of C++.
Since Org knows little of it. He did make a Zork-like game. Almost.
Logged

Outcast Orange

  • Bay Watcher
  • [SOMETIMES_SQUID]
    • View Profile
    • The Outcast Orange
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #172 on: June 20, 2010, 11:06:53 pm »

That was a good time.

I am here to offer my feeble help.
Logged
[7:53:55 PM] Armok, why did you demand that I don't eat you?
[7:54:34 PM] [Armok]: woooooo

Burried Houses - Platform Explorer Demo H - Cloud Scream

Urist McUristy

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #173 on: June 22, 2010, 12:19:37 am »

I decided I wanted to learn how to code in some language, so I decided to learn C++.
Only thing is I don't know what is a good editor/compiler to use for a beginner...
So I was wondering if someone could help me with that by posting a link to one
thats easy to use, thanks in advance!
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #174 on: June 22, 2010, 07:10:33 am »

Hi Uristy!

There are basically two camps here:
Code::Blocks, which is free, cross-platform and unprofessional, and uses the GCC compiler.
and
Microsoft VC++, which is professional, although you only get the "express" version for free, it's windows-only (the IDE, in b4 nitpickers), and has its own compiler.

Which to choose? Please don't ask here, before we get into another "My Compiler/IDE Is Better"-flamewar  ;)
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))

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #175 on: June 22, 2010, 08:02:00 am »

Either (MSVC's compiler, or any variation of GCC (MinGW (GCC compiling for windows) or Cygwin (compiles like GCC on non-windows, links to a library for functions not present in windows) on windows, GCC everywhere else) can also be invoked from the command prompt or a batch file, though an IDE is usually better in every way... (except startup time)
Logged
Eh?
Eh!

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #176 on: June 22, 2010, 04:11:08 pm »

Edit: oops, Wrong topic.
« Last Edit: June 22, 2010, 04:13:32 pm by eerr »
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #177 on: June 24, 2010, 04:20:12 am »

I'm trying to port something a wrote in C# a few months ago to C, and I'm having some issues.

my C# code looks something like this:
Code: [Select]
byte y[] = new byte[88200];

for (t = 0; t < 88200; t++)
  {
  double i = sin(t);
  y[t] = (byte)i;
  }
// ignore syntax errors, they ain't my focus

and my C code looks like so:
Code: [Select]
float *y;
y = (float *) malloc(88200 * sizeof(float));

for (t = 0; t < 88200; t++)
  {
  float i = sin(t);
  *(y + t) = i; // no (byte) caste here :(
  }
// ignore syntax errors, they ain't my focus

The lack of (byte) caste in the C code seems to screw things up. My question is, how do I convert a float to a byte in C?
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #178 on: June 24, 2010, 10:03:18 am »

Char is C++'s byte.
Logged
Eh?
Eh!

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #179 on: June 24, 2010, 01:14:03 pm »

So I've been told, but I use floats, and have to use floats, because I'm using the sin() function, which, obviously, outputs decimal fractions, and chars don't support decimal fractions.

Never mind, multiplying it by 128 fixes it up, thank you.
« Last Edit: June 24, 2010, 01:19:52 pm by ILikePie »
Logged
Pages: 1 ... 10 11 [12] 13 14 ... 78