For my solution to this month’s Exercise I went binary. Several of the C language operators work at a binary level. Because the exercise was to make a binary, or bitwise, modification, I figured a binary operator would be in order.
Continue reading
Author Archives: dgookin
Skipping
Of the two C language keyword looping statements, for is the most traditional and probably the most popular. It’s also the most frustrating for beginners because of its many parts. But eventually, a comfort level arises with using the for loop, which is sad because it’s more powerful than a simple counter.
Continue reading
Flip That Bit
All the nonsense that takes place in programming happens because it’s possible to change the value of a bit from 0 to 1 and back again. The general concept is known as a toggle switch: The item can be set and reset between on and off positions.
Continue reading
C Language Neat Tricks #2 (Part II)
You could call it a neat trick or just something so oddball insane that few programmers would dare breech the territory: A variable that holds the address of a function; a function pointer.
Continue reading
C Language Neat Tricks #2 (Part I)
Like a variable in the C language, a function has an address — a location in memory. This fact shouldn’t be surprising to you. After all, the function has to sit somewhere. And my guess is that location doesn’t change as the program runs.
Continue reading
C Language Neat Tricks #1
The C language holds the potential of being utterly terrifying, which is something I admire greatly. Many beginners, as well as foolhardy travelers from other languages, treat a lot of the C language constructs as absolutes when, in fact, they aren’t. Therefore I present this week’s Lesson, the first in an ongoing series about strange, beautiful, and frightening things in the C language.
Continue reading
Plotting Squares – Solution
The key to unlocking this month’s Exercise is not to go insane on the code that processes the solution. As I wrote in the Exercise post, with data analysis in C, it’s important to properly represent the data so that you can easily manipulate it.
Continue reading
More Heavily Weighted Random Numbers
One area where weighted random numbers come in to play is when doing a simulation. In a recent set of Exercises (May and June 2015), your mission was to craft a bowling game simulator. Like most simulations, the bowlings game simulator made use of random numbers. The problem in this situation is most decent bowlers don’t roll randomly.
Continue reading
Weighted Random Numbers
Random numbers are useful when simulating information and they add a degree of unpredictability to computer games. The problem programmers run into, especially with simulation, is that not everything is truly random. In many cases, some numbers need to be more random than others. The solution is to generate weighted random numbers.
Continue reading
Plotting Squares
The term sounds terrifying, but it doesn’t need to be: Data analysis is the process of using code to examine data and come up with some sort of conclusion. Obviously it helps to know the type of conclusion before you write the code. Only in science fiction does someone say, “What do you make all of those seemingly boring numbers, Mr. Computer?”
Continue reading