(what's this all about?)


In February 2014, we rebooted weekend-challenge and created a tag.

Here are some stats (as of 2014-03-02):

  • First entry was posted on 2014-02-02 (14 votes, )
  • Last entry submitted in February was posted on 2014-02-24 (10 votes, )
  • 8 entries were submitted during the month, by 7 users.
  • 23 answers were posted - that makes it 2.875 answers per question (std.dev 1.36 which, in my books, means the 2.875 is very representative).
  • 4,107 views, or 513.375 per question (std.dev 503.815 which means the data is quite scattered, ranges from 55 to 1,373)
  • 11.125 average question score (std.dev 2.642 which means most entries earned the participant a [badge:nice-question]).

Add to that @syb0rg's late entry posted 2014-03-04 (17 votes, ), with 1,206 views and 4 answers (13-8-3-1 votes), currently the top-voted post, and then consider that @SimonAndréForsberg hasn't posted his already publicly playable game as of yet, we're looking at a very, very successful event that is positively affecting the site's overall stats.

April 2014

Let's do this again, shall we? Let's take all of March to decide what the next challenge should be (and to let other late entries get posted).

What should the next be?

Note: it's the number of votes that determines the winner - downvotes don't count!

And the winner is...

2-player card fighting game (+15/-1)

Please tag questions/entries with , , as well as any other applicable tag(s).

For people that can't see the vote breakdown:

  • 1
    \$\begingroup\$ Last entry, should be "most recent entry"! As you know, I'm not done yet :) \$\endgroup\$ Commented Mar 6, 2014 at 21:29
  • 5
    \$\begingroup\$ I like that we are extending the time period to let new challenge ideas come about. It should bring about a few neat ideas that people will want to participate in! \$\endgroup\$
    – syb0rg
    Commented Mar 6, 2014 at 23:41
  • 3
    \$\begingroup\$ Note: It's the number of upvotes that determines the winner, downvotes don't count! \$\endgroup\$ Commented Mar 12, 2014 at 13:40
  • \$\begingroup\$ I don't understand this. What is the challenge? \$\endgroup\$ Commented Apr 6, 2014 at 11:23
  • 1
    \$\begingroup\$ @Ilya_Gazman to participate, you write an implementation for the (very loosely specified) winning proposal (2 player card fighting game), and submit it for review; then you can follow the code-challenge tag and review other people's implementations. Lots of reviewers hardly ever "ask a question" on the site, this makes an opportunity for it! These posts tend to get high visibility, too :) \$\endgroup\$ Commented Apr 6, 2014 at 14:35
  • 1
    \$\begingroup\$ What are votes on questions tagged 'code-challenge' supposed to represent? Is it the same as usual code review questions, or is it a rating of the code posted? \$\endgroup\$ Commented Apr 18, 2014 at 0:43
  • \$\begingroup\$ @BenAaronson these "challenges" are just for fun, they do tend to get attention, but so do most questions... take it as an idea for a piece of code you could write for the heck of it and then get it peer reviewed on CR (and then to review other people's implementations), a bit like a sport, but one that has nothing to do with golf. So yeah, same as every other question! ;) \$\endgroup\$ Commented Apr 18, 2014 at 1:10
  • \$\begingroup\$ @Mat'sMug Okay, sure! I realise it's just for fun of course, was just wondering if it was supposed to be a competition rated by votes or not \$\endgroup\$ Commented Apr 18, 2014 at 1:17
  • 1
    \$\begingroup\$ Nah, everybody wins! \$\endgroup\$ Commented Apr 18, 2014 at 1:18

5 Answers 5


2-player card fighting game

This is not about playing cards as in "Hearts, Diamonds, Clubs and Spades".

This is a game where 2-players (or more if you are really enthusiastic) can play/use cards or spells to do some effect against themselves or their opponent(s).

Minimum requirement:

  • Two players
  • Players have hit points (call it whatever you want, the effect remains the same)
  • At least 10 different playable cards
  • When a player has 0 hit points, he's out of the game. Last player standing wins.

You may freely decide how many cards each player starts with on hand and how the logic of your game goes. In case you don't want to or can't come up with something, below is a...

Description of how Castle Wars 2 works:

  • Each player has a deck of at least 75 cards.
  • Each player always has exactly 8 cards on hand
  • Each player has hit points in the form of a castle and a wall
  • There are three kinds of resources: Bricks, Weapons, and Crystals
  • At the start of each turn you get resources from your resource producers: Builders (produces bricks), Recruit (for Weapons) and Wizards (for Crystals)
  • On each of your turns you can either play a card or discard up to three cards
  • For each card you play or discard you draw a new card
  • You can win by getting your castle up to 100, or your opponent's castle down to 0.

Extending it further...

If you'd like to, you can make your game more advanced by adding cards that remain in game after they have been played. The games Yu-Gi-Oh! and Magic: The Gathering has certain types of cards that can be used while on the "battlefield". They can be used in battle one per turn and some cards has abilities that can be activated.

See these resources for inspiration:

If you are not familiar with Yu-Gi-Oh! or Magic: The Gathering, I suggest making your version of Castle Wars 2.

Take the challenge as far as you would like!

If you have any questions or need some ideas, add a comment or find me in The 2nd Monitor

If you need ideas...

  • Two players
  • Both players starts with 5 cards on hand, no maximum hand size.
  • Players start with 30 health.
  • When a player has 0 hit points, he's out of the game. Last player standing wins.
  • Each player has Mages, Warriors and Kings as resources. A player starts with 5 warriors and 3 mages and one king.
  • Only one card can be played each turn, if no card can be played you just have to skip your turn.
  • At the beginning of your turn, you draw a card
  • At the beginning of your turn, you gain mages and warriors equal to the number of kings that you have.
  • 10 playable cards:
    • Attack: Costs 3 warriors. Deal 5 damage to your opponent
    • Recruit: Costs 2 mages. Gain 5 warriors.
    • Panic Kingdom: Costs 1 king, gain 10 warriors and 10 mages.
    • Pick a King, Any King: Costs 6 warriors and 6 mages, gain 1 king.
    • Heal Me: Costs 2 mage, gain 4 health.
    • All-In!: Costs 10 warriors. Deal 15 damage to your opponent
    • Mega Heal: Costs 5 mages, gain 11 health.
    • Transforming: Costs 2 warriors, gain 3 mages.
    • Wizards in the city: Costs 2 warriors, gain 4 mages.
    • Slay Kingdom: Costs 7 warriors and 7 mages, destroy all enemy warriors and mages.
  • How you construct the decks the players use is up to you :) If a player runs out of cards in the deck, the deck is rebuilt from it's ordinary state.

Note that I have no idea how balanced this game would be, these cards and rules are primarily meant as inspiration. Game balance is not important, only code is important.

  • 2
    \$\begingroup\$ Hearthstone could be an example too. (the new game of Blizzard) \$\endgroup\$
    – Marc-Andre
    Commented Mar 11, 2014 at 15:44
  • \$\begingroup\$ You want to implement the crafting mechanics, Class-Compliant decks and the whole story around that?? Good Luck... \$\endgroup\$
    – Vogel612
    Commented Mar 12, 2014 at 14:57
  • 1
    \$\begingroup\$ @Vogel612 Absolutely not necessary. I'm aware that Magic and Yu-Gi-Oh! are way too big to implement everything. Take the challenge as far as you would like. Just a few of the cards is enough. \$\endgroup\$ Commented Mar 12, 2014 at 15:07
  • 2
    \$\begingroup\$ @Vogel612 I don't know if you were asking to me or Simon, but I was just mentioning another example of a card game so we have more ideas/examples. You don't need to do an exact duplicate of the game. \$\endgroup\$
    – Marc-Andre
    Commented Mar 13, 2014 at 17:16


(or Dr.Robotnik's Mean Bean Machine, or Kirby's Avalanche... just give it a fun name)

The object of the game is to defeat the opponent in a battle by filling their grid up to the top with garbage. The Puyos are little creatures with eyes who, in most variations of the game, fall from the top of the screen in a pair. The pair can be moved left and right and rotated. The pair falls until it reaches another puyo or the bottom of the screen.

Chain reactions

When four or more puyos of the same color form together to create a group, they disappear. Individual puyos can connect horizontally or vertically, but not diagonally; the whole group need not be a line, but can be any tetromino (or larger). This is called a Rensa (Chain)


Whenever a rensa is achieved, Ojama (Garbage blocks) are sent to the opponent. The bigger the Fluent Rensa is, the more ojamas are sent to the opponent. It is calculated by the overall score of the chain divided by 70 and rounded up to the nearest integer. For example:

Player A forms a group of 4 red puyos as a single chain.

The score card reads "40 x 1" (Simply by the following: (Puyo * 10) x (Puyo - 3) -> (4 * 10) x (4 - 3) -> 40 x 1).

40 is the total score of the chain, so this is divided by 70, to give 0.571 (to 3.s.f)

This value is rounded up to the nearest integer, which is 1. One ojama will fall on the opponent's grid. If more puyos are erased in succession due to a Fluent Rensa, the amount of garbage will keep going up until the chain ends. Ojama puyos are dropped in rows of six, with the extra ojamas distributed in random columns. If more than 30 ojamas are sent, they will be dropped in groups of 30.

Ojama block the opponent's playing field, and can cause them to lose if they reach up to the top of the grid. Ojama are eliminated if puyos are eliminated adjacent to them.

I've spent wasted countless hours of my life playing that game. Now I feel like making my own. Not sure 1 month is enough though.

  • 5
    \$\begingroup\$ An alpha version is probably about 4 hours' work, so a month could be enough time to get a version which is ready to submit for review. \$\endgroup\$ Commented Mar 11, 2014 at 19:00
  • \$\begingroup\$ Will this be split screen sharing a single computer, or running on two computers across a network/internet? \$\endgroup\$ Commented Mar 15, 2014 at 16:37
  • 1
    \$\begingroup\$ @githubphagocyte that's all up to you! You can make it an XNA game on Xbox, or a single player demo on Android (tweak the garbage rules as needed), or whatever you want it to be ;) \$\endgroup\$ Commented Mar 15, 2014 at 16:42

Standard-Compliant Container Implementation


Pick a language of your choosing and a container of your choosing and implement it, fully conformant to the standard. For example, this could mean picking C++ and implementing std::unordered_map or std::vector, or perhaps Java's java.util.ArrayList or java.util.HashMap.

Note: a standard container doesn't strictly have to be chosen. It's just fun to implement standard containers :).


Challenges in the past have focused on relatively complicated design, but I find it refreshing to focus on technical details from time to time. If you've never implemented a standard container before, I can guarantee that you'll learn at least half a dozen things.

A lot of clever thought and language knowledge is required to efficiently and effectively implement a standard compliant container. For example, implementing even one of the relatively simple containers in C++ requires detailed knowledge of memory management, exception safety, const correctness, and templating.

Implementing a container can also help understand why certain design decisions were made. For example, anyone familiar with C++'s std::stack may have wondered before why pop() returns void. Careful thought about how to safely implement a value returning pop will reveal the answer. (Hint: is there a way to safely implement a returning pop?)


In addition to learning about a language, containers are a great opportunity for unit testing. In addition to the implementation, this challenge will require that a test suite be provided that thoroughly tests the container. Optionally, an existing test suite could be used (for example LLVM has very thorough tests for all of the C++ containers).


  • Pick a language with a well defined, language-level container library (C++, Java, C#, etc)
  • Pick a container -- ones without algorithmic requirements (e.g. balanced trees) will be simpler
  • Either carefully read the standard, or just copy the method signatures and read the documentation on each method
  • Little by little, add tests and functionality until the container is complete and well tested
  • \$\begingroup\$ So in C# that would be implementing a Stack<T> or a Queue<T>, or a List<T>, or whatever? \$\endgroup\$ Commented Mar 11, 2014 at 2:40
  • \$\begingroup\$ Is it intentional that the Java suggestions are classes rather than interfaces (java.util.List, java.util.Map)? \$\endgroup\$ Commented Mar 11, 2014 at 12:28
  • \$\begingroup\$ @Mat'sMug Correct. \$\endgroup\$
    – Corbin
    Commented Mar 11, 2014 at 18:35
  • \$\begingroup\$ @PeterTaylor It was just to be consistent with the C++ suggestions since ArrayList and HashMap are more or less the Java analogues of std::vector and std::unordered_map. In an actual implementation, the interface would be implemented. It's just that the implementation might act as one of those concrete classes. (And don't forget that the rules are pretty open -- any container can be implemented) \$\endgroup\$
    – Corbin
    Commented Mar 11, 2014 at 18:37
  • \$\begingroup\$ Should concurrency be a consideration for this challenge? \$\endgroup\$
    – skiwi
    Commented Mar 15, 2014 at 20:26
  • \$\begingroup\$ @PeterTaylor For Java, I think that you want to implement the interface, while mimicking the design of the concrete implementation. So you could be mimicking ArrayList, while implementing the List interface. \$\endgroup\$
    – skiwi
    Commented Mar 15, 2014 at 20:30
  • \$\begingroup\$ @skiwi It could be, but it's not required to meet the criteria of the challenge. In general though, unless someone is already very familiar with non-concurrent containers, I would discourage the concurrent route. Performant concurrent containers can get very tricky very quickly. \$\endgroup\$
    – Corbin
    Commented Mar 15, 2014 at 20:36
  • 3
    \$\begingroup\$ "It's just fun to implement standard containers :)." -- IMHO it has become no longer a huge amount of fun to review standard containers: how many "linked list" implementations do you want to review? \$\endgroup\$
    – ChrisW
    Commented Mar 18, 2014 at 14:31
  • \$\begingroup\$ @ChrisW I'm afraid I just agree. Lately linked list have become quite a bore. Hopefully though, people would implement more interesting containers, and, by the end of April, maybe the Great Linked List Surge of March will have been forgotten. \$\endgroup\$
    – Corbin
    Commented Mar 18, 2014 at 15:21

My idea is to make a Rock Paper Scissors AI!

Basic idea:

The goal of the challenge is to build a client that supports:

  • The ability to enter Rock, Paper or Scissors as human.
  • An AI opponent.
  • The ability to play a RPS-game against an AI as a human.

Rules of the AI:

  • The gesture (Rock, Paper or Scissors) of the current turn of the player (AI's opponent), may not be used for deciding the current turn's gesture of the AI.

Goal of the AI:

  • Always win from the player, with a win defined as having more than 50% wins over a set number of games.

Future ideas:

The AI's should battle against other AI's, instead of other humans!

To faciliate this, we need:

  • A common communication model for all AI's, possibly system in/out or network communication.
  • A server that supports a load of programming languages to run every AI and match them up accordingly.

A ranking will be posted after playing a set number of games, where each AI battles every other AI an equal amount of times.

  • \$\begingroup\$ +1, my RPSLS never ended up with an AI... \$\endgroup\$ Commented Mar 15, 2014 at 21:14
  • 3
    \$\begingroup\$ An AI is a good idea, but I don't think RPSLS is the best game to do it in. But in case you are interested, check this one out: nytimes.com/interactive/science/… \$\endgroup\$ Commented Mar 15, 2014 at 23:29
  • \$\begingroup\$ @SimonAndréForsberg An interesting link... I do not see your arguments to not do this challenge though. \$\endgroup\$
    – skiwi
    Commented Mar 16, 2014 at 11:41
  • \$\begingroup\$ Might have to do with @Simon having already implemented AI for his RPSLS solution... \$\endgroup\$ Commented Mar 16, 2014 at 14:59

Late to the game,

but I've set my own challenge, write a Gaussian elimination routine.

More specifically, to solve this challenge : http://www.enigmagroup.org/missions/programming/9/

I would be interested to see how other people would solve this, I already have found many ways to do this wrong.

Good question from @rolfl:

it basically shows a 5 by 5 grid with 5 symbols and symbol values.


  • 2 circles and 3 squares is 230
  • 2 circles and 2 triangles is 500
  • 3 squares and 5 triangles is 1000 etc etc

What are the values of circle, square, triangle etc.

I plan to to have an array of rules that contain the variables and the sum value, the solver will return an array with the value for each variable.

I also should disclose that this question is a terrible implementation of trying to solve this problem. And that my inspiration for this came from RobH's comment.

Finally, the HTML grid looks like this : http://jsbin.com/romiw/9 The code looks terrible, I am mostly messing around at this point ;)

  • 2
    \$\begingroup\$ You must be logged into EnigmaGroup.org to complete the missions. .... what is the challenge? \$\endgroup\$
    – rolfl
    Commented Mar 21, 2014 at 15:14
  • \$\begingroup\$ @rolfl Updated the question \$\endgroup\$
    – konijn
    Commented Mar 21, 2014 at 17:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .