clemsonacm / hackpack

A collection of tools and algorthithms used by Clemson ACM
15 stars 9 forks source link

Welcome

This is the Clemson ACM Repo. We are the local chapter of the Association for Computing Machinery at Clemson University in Clemson, South Carolina. We do cool computing stuff for cool computing people!

What is this repository for?

This repository contains resources developed to aid with doing cool stuff in Computer Science. The main projects are as follows:

Clemson Hackpack and Hackpack++

How do I get set up?

Depending on what you are doing you will need different tools:

Clemson Hackpack and Hackpack++

Contribution Guidelines

Clemson Hackpack and Hackpack++

For all projects and improvements:

  1. Choose an issue from the issue tracker
  2. Fork the repo to your personal account
  3. Make your changes to your personal copy
  4. When the code is complete, create a pull request in GitHub from your copy to ours
  5. When the pull request is reviewed and approved, the code will be merged by one of the owners into master.

If you have any questions related to the issues in the tracker, comment on the issues and mention one of the owners.

Folder Structure and File Naming conventions

All examples assume a topic called foo and a sample problem bar:

Writing Documentation

Documentation should be written in LaTeX: For each item in the Hackpack, please include the following in clearly delineated subsections:

  1. Name and Brief Description of the topic
  2. Data structures should have a "Reference" section with a code sample of only commonly used functions
  3. A list of possible uses and applications
  4. 2-3 possible contest problems; preferably of varying difficulty
  5. Sample code that answers one of the contest problems
  6. Please use the \acmlisting for code listings. A caption and label should be specified. If applicable, line ranges should be specified to limit the amount of text displayed.
  7. It would be preferred if each set of sample code had some lessons learned to point out some key elements of the implementation
  8. References using BibTeX where applicable
  9. Should be "compiled" properly by make
  10. Each sentence must be on a separate line.
  11. The condensed version of the hackpack should have the following removed:

    • Introductions to the topic.
    • Guidelines directing the reader to different sections of the hackpack.
    • References to contest problems including statement, sample io, and lessons learned, but solutions should remain.
    • As much as possible, index tags should NOT be removed.

Writing Code

Code Must meet the following standards:

  1. Code should be indented with tabs and not exceed 80 characters per line.
  2. Code must compile under contest conditions: g++ -g -O2 -std=gnu++0x -static $*
  3. Code must be delivered with the passing unit tests.
  4. Code must be commented with detailed explanations and asymptotic notation where applicable
  5. Code must be concise but not at the expense of readability
  6. Source code must solve a problem: It should solve a specific problem and include all relevant IO and supporting code. The algorithm should not be in a vacuum.
  7. The condensed hackpack version should have the following removed:

    • Comments that are not critical to the readers understanding
    • All library and #include code that can be found in other sections of the hackpack
    • All input and output code that is not critical to the readers understanding

Writing Tests

All code must have tests that meet the following requirements

  1. All tests should be written using the bats framework, and use tap compliant mode. See the structures/set section for an example.
  2. Test at least the upper and lower boundaries of the allowed inputs.
  3. Testing files should be postfixed by -test prior to the extension. For example, foo.cpp test files should be called foo-test.cpp and foo-test.in respectively
  4. Tests should be runnable by calling make test in the directory of the source

    • The tests should return 0 in the case that all test cases passed
    • The tests should return 2 in the case that any test cases failed

Different Versions of the Hack Pack

The hack pack is from one source built into two versions: one slim (hackpack) and one tome-like (hackpack++, or as denoted in the build scripts, hackpackpp). But how? By a combination of awk and dark magicks, authors can use an extremely limited set of C-preprocessor-like #ifdefs to denote a block of text or code as part of one version or the other. Here's an example:

// #ifdef hackpackpp
cout << "This is the Hack Pack: plusplus edition!" << endl;
// #endif
// #ifdef hackpack
cout << "This is just the regular hack pack." << endl;
// #endif

The first cout will only appear in the hackpack++'s code listing, and the second will only appear in the normal hackpack. Note that the #ifdefs are commented out: as long as the line ends with the if directive, they'll work properly. You might want to comment them out so that they don't break the compilers. Make sure you have a new line after each directive somewhere!

Here's a list of filetypes where the if directives will work:

Building the Hack Pack

The hack pack uses a Makefile for building our PDF output. Here's a rundown of the make rules you'll probably be using:

Who do I talk to?

Contact one of the members of the Hackpack Developers groups with any questions.