#cubicprogramming
Explore tagged Tumblr posts
cubicprogramming · 9 years ago
Text
97 - Collatz Conjecture
https://github.com/CubicProgramming/ProgrammingChallenges/blob/master/97-Collatz.cpp
0 notes
cubicprogramming · 9 years ago
Text
85 - Fibonacci
85) Fibonacci Sequence (at least 100 numbers)
Alright, so I know what you’re thinking... 6 KB for a Fibonacci implementation? Isn’t that a bit excessive? Well... Yes and no. While only about ten lines of code at the most are needed for a working Fibonacci function, the real challenge of this program was going beyond the hundredth’ Fibonacci number.
Because around the 95th number, the actual value goes beyond 2^64 -1, the largest number possible in the existing data types, I had to sort of re-invent the wheel. I used the vector data structure because it allows for a dynamic, volatile number of entries. But I wasn’t really content with using the decimal system, as that would waste significant space, so I used base-16 (hexadecimal) for addition operations, which was an incredible learning experience.
0 notes
cubicprogramming · 9 years ago
Text
83 - Hangman
Hangman
I’d place the difficulty programming this between the 15-piece sliding puzzle and Tic Tac Toe... It wasn’t actually that difficult implementing the checks, just a bit time-consuming checking everything worked.
0 notes
cubicprogramming · 9 years ago
Text
Challenge 71-Luhn Algorithm
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the US, and Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn
LuhnAlgorithm.cpp
Nothing too major, but this algorithm was kind of fun in seeing all the different implementations that existed
0 notes
cubicprogramming · 9 years ago
Text
Challenge 61 - 15 Piece Sliding Puzzle
15 Piece Sliding Puzzle.cpp
A definite step up in difficulty from the Tic-Tac-Toe program, the 15 Piece sliding puzzle is still at a level where it shouldn’t give programmers knowledgeable about arrays much issue.
The reason this is more challenging than the Tic-Tac-Toe program is that, because this puzzle could theoretically go on forever, there’s no way to hard-code every single possible state (and yes, someone actually hard-coded Tic-Tac-Toe... It’s extremely painful: https://github.com/asweigart/my_first_tic_tac_toe/blob/master/tictactoe.py), so actual thought is required on this front.
5 notes · View notes
cubicprogramming · 9 years ago
Text
Challenge 60 - Text to Morse
Text-To-Morse-To-Text.cpp
This challenge isn't necessarily "complex", but it is definitely tricky. It is useful to do in the sense that it helps the programmer understand basic file operations (if they have the Morse codes in a file as opposed to an array within the source code) as well as understanding how to process the file.
As usual, I had a lot of fun learning to do this. Morse Code has a certain elegance in its simplicity that isn’t really found anywhere.
0 notes
cubicprogramming · 9 years ago
Text
Challenge 40 - Tic Tac Toe
TicTacToe.cpp
From what I can gather, this challenge was included to get the programmer used to making games, by which I mean something with a definitive start and end, all based on user input. Not too difficult to implement, but it was fun programming this nonetheless
0 notes
cubicprogramming · 9 years ago
Text
Challenge 21 - Overlapping Rectangles
Challenge 21: From two 2-D Rectangles, check if they overlap, and if they do, calculate the area
This one was actually kind of tricky, trying to figure out a way to implement the program in a way that would account for all sorts of rectangles... In the end, not too difficult once you realize the minimum information needed to make a rectangle (two points) and knowing that the middle two x and middle two y values make a rectangle on their own (if the two rectangles do happen to intersect)
0 notes
cubicprogramming · 9 years ago
Text
Challenges 2,86,93
Calculates Wind Chill, Converts units of Degrees, and BMI
Honestly, this is one of the easier challenges... The hardest part was finding out the wind chill calculation, and even then, it was pretty self explanatory... I'd say this challenge is decent for an absolute beginner at a language
0 notes
cubicprogramming · 9 years ago
Text
Challenges 17 and 23: Dates
17) Calculate and Print Calendars for Arbitrary Months and Years
23) Calculate the Distance between Two Dates
Header file
Header Implementation
Distance Between Dates and Implements the Date Class
0 notes
cubicprogramming · 9 years ago
Text
Challenge 14 - Quine
“A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs". “ - From Wikipedia (https://en.wikipedia.org/wiki/Quine_(computing))
This was an interesting experiment, I guess...
CODE:
//Quine2.cpp #include int main(int argc, const char * argv[]) { // insert code here... std::string quineArray[1]; quineArray[0] = "//Quine2.cpp #include int main(int argc, const char * argv[]) { std::string quineArray[1] quineArray[0] = ""; for(int i = 0; i < quineArray[0].length; i++) {std::cout << quineArray[0][i];}return 0;"; for(int i = 0; i < quineArray[0].size(); i++) { std::cout << quineArray[0][i]; } return 0; } </div>
1 note · View note
cubicprogramming · 9 years ago
Photo
Tumblr media
So this is how it's gonna go:
I found this image on /g/, 4Chan's technology board, and it was baffling to  me how little I could do. I’ve known how to program for about a year, and the fact that I couldn’t do all of these kind of irked me.
So I decided to not be a useless piece of trash and begin tackling these, one by one.
I have a long ways to go, but as the journey of a thousand miles begins with a single step, so too, does finishing all of the Pro/g/ramming Challenges begin by swallowing your pride and opening up XCode
I invite all of you to join me in doing as many of these as possible. If you can’t do the hard ones, start with the easy ones, and if you find Tic-Tac-Toe too easy, challenge yourself! You can’t be a good programmer if you don’t program something too easy... Challenge yourself!
0 notes