Questions tagged [game]

This challenge is generally based upon, related to, or simulates a game or some portion of one.

Filter by
Sorted by
Tagged with
1233 votes
6 answers
302k views

Build a working game of Tetris in Conway's Game of Life

Here is a theoretical question - one that doesn't afford an easy answer in any case, not even the trivial one. In Conway's Game of Life, there exist constructs such as the metapixel which allow the ...
Joe Z.'s user avatar
  • 34.9k
25 votes
10 answers
3k views

Name the poker hand

Name the poker hand Given five cards, output the name of the poker hand, which will be one of: ...
daniero's user avatar
  • 18.6k
134 votes
22 answers
13k views

Red vs. Blue - Pixel Team Battlebots

This contest is officially over. The Blue Team won! I autoran two sets of 50 battles and amazingly, Blue won all 100 of them. Looking at the stats, it is clear that the cooperative entries of PhiNotPi ...
Calvin's Hobbies's user avatar
43 votes
5 answers
3k views

Block Building Bot Flocks!

The contest is over! Intro This is an interactive king-of-the-hill contest where the controller is fully contained in a Stack Snippet at the bottom of the question. The controller automatically ...
Calvin's Hobbies's user avatar
28 votes
7 answers
4k views

Score a Cribbage Hand

This challenge is to score a Cribbage hand. If you don't play Cribbage, you've got some learning to do. We play with a standard poker deck, and a hand consists of four cards plus the "up card". ...
boothby's user avatar
  • 9,786
28 votes
20 answers
3k views

Cooperative Counting

Final results 1st place goes to Follow! Honourable mentions to The diff predictor (2nd), and Simple Killer, Low Blow and High to Low (joint 3rd). Other winners: (score competition) 1st - Simple Killer ...
user19642323's user avatar
28 votes
7 answers
13k views

Write a Hangman Solver

You are required to write a Hangman solver. Testing against this English word list[1], the solver that solves the most number of words wins, with the number of total incorrect guesses being the tie-...
user12205's user avatar
  • 9,028
16 votes
5 answers
2k views

Play Wythoff's Nim perfectly

Your goal is to write a perfect player for the game of Wythoff's Nim. Rules of Wythoff's Nim Wythoff's Nim is a deterministic two-player game played with two piles of identical counters. Players ...
xnor's user avatar
  • 145k
15 votes
2 answers
1k views

Become the Hydra Slayer

You are the best and most famous hero of the area. Lately there have been rumors that a Hydra has been hanging out in a nearby ravine. Being the brave and virtuous hero that you are you figure you'll ...
Wheat Wizard's user avatar
  • 98.5k
48 votes
56 answers
5k views

Scrabble scorer

Challenge: Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English. Rules: The score of each letter is as ...
Stewie Griffin's user avatar
40 votes
8 answers
7k views

Hunt the Wumpus

When I was a lad, kids would wander into computer stores and play Hunt the Wumpus until the staff kicked us out. It was a simple game, programmable on the home computers of the mid-1970s, machines so ...
Michael Stern's user avatar
32 votes
10 answers
33k views

Pong in the shortest code

The challenge is simple. Give the shortest code possible to reproduce the classic 2-player game of pong http://en.wikipedia.org/wiki/Pong . The level of graphics and functionality should be as close ...
user avatar
28 votes
4 answers
3k views

Implement a Non-Guessing Sudoku Solver

Implement the shortest Sudoku solver. Sudoku Puzzle: ...
snmcdonald's user avatar
27 votes
39 answers
7k views

Rock Paper Scissors

Implement the classic rock paper scissors. Conditions: user will input 'r', 'p' or 's' program will output 'r', 'p' or 's' and the result program choice ('r', 'p' or 's') has to be pseudo random (I'm ...
jsedano's user avatar
  • 1,713
25 votes
26 answers
6k views

Determine win in Tictactoe

Let's play some code golf! Given a tic-tac-toe board state (Example:) |x|x|o| |x|o|x| |o|o|x| Determine whether a game is a win ...
Dylan Madisetti's user avatar
25 votes
13 answers
6k views

Implement a Brute Force Sudoku Solver

Implement the shortest Sudoku solver using guessing. Since I have received a few request I have added this as an alternative question for those wishing to implement a brute force sudoku solver. ...
snmcdonald's user avatar
23 votes
16 answers
6k views

Alice and Bob have a fight

Alice (A) and Bob (B) decided to have a battle. Each combatant has 10 health. They take turns to roll a 6 sided die for damage. That damage is removed from their opponent's health. In the end either ...
AJFaraday's user avatar
  • 11.8k
15 votes
3 answers
3k views

What are you waiting for? (A mahjong solver)

Idea thanks to @MartinBüttner from a discussion in chat Mahjong is a tile game that is immensely popular in Asia. It is typically played with four players, and the goal of the game is to be the first ...
Sp3000's user avatar
  • 61.9k
13 votes
1 answer
1k views

Solitaire Dreams - Creating a winnable solitaire starting hand

It's me. Cave Johnson. It's May 21st. You are working at Aperture Science, finest company on Earth, and tomorrow we're releasing Version 3.0 of our flagship windowing system (or WindowS): CavOS. ...
lochok's user avatar
  • 3,189
10 votes
14 answers
2k views

Guess the number [closed]

Description Create a fully working "Guess the number" game. The game is played by two players as follows: player one chooses a number (A) between 1 and N player two tries to guess A choosing a ...
Eelvex's user avatar
  • 5,512
104 votes
32 answers
13k views

Formic Functions - Ant Queen of the Hill Contest

Watch live | Active answers | Add new answer | Chat room | Source code | Leaderboard New tournaments whenever needed. New players and new updates very welcome. Not actual game footage. Each player ...
trichoplax is on Codidact now's user avatar
72 votes
48 answers
9k views

Magic the Gathering: Friends or Foes?

In the card game Magic: the Gathering there are five different colours, which represent loose affiliations of cards, White (W), Blue (...
Martin Ender's user avatar
56 votes
9 answers
34k views

Create a simple 2048 game clone

2048 is an incredibly fun and addictive game in which the goal is to create a tile with 2048 on it. Here's a short description of the game: Pressing an arrow key will slide all the blocks in the ...
Doorknob's user avatar
  • 71.5k
48 votes
22 answers
7k views

Highlight a Wordle guess

In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints. If you guess a letter which matches the letter in the same position in the secret word, the ...
pxeger's user avatar
  • 23.7k
35 votes
1 answer
3k views

Minesweeper Solver

We already generated Minesweeper fields, but someone really has to sweep those generated mines before PCG blows up! Your task is to write a Minesweeper Solver that is compatible with a slightly ...
TimWolla's user avatar
  • 1,950
33 votes
30 answers
8k views

Dollar Bill Auction

This is a KOTH challenge for the dollar bill auction game in game theory. In it, a dollar is being sold to the highest bidder. Bids go up in increments of 5¢, and the loser also pays their bid. The ...
RamenChef's user avatar
  • 1,214
29 votes
5 answers
2k views

Take It or Leave It: A Game Show for Computers

Context: A reclusive billionaire has created a game show to attract the world's best and brightest programmers. On Mondays at the stroke of midnight, he chooses one person from a pool of applicants ...
LivingInformation's user avatar
25 votes
3 answers
2k views

Leonhard loves labyrinths

The background My son Leonhard (4 years old) loves labyrinths. I don't know where he knows labyrinths from, but he paints them and knows quite well how they work: Recently, he started making a game ...
Thomas Weller's user avatar
24 votes
21 answers
2k views

Prisoner's Dilemma with access to opponent

In this challenge, you will write a bot that play's the prisoner's dilemma. Here's the catch: you will not have access to the history of previous games. Instead, you will have access to the opponent ...
soktinpk's user avatar
  • 4,462
14 votes
3 answers
1k views

A BlackJack KOTH contest

BlackJack As I had a blast working on the original KOTH challenge, I wanted to come up with another one. For me, the fun of these AI challenges is in refining a comparatively simple bot ...
arrdem's user avatar
  • 846
14 votes
5 answers
3k views

Compare two poker hands

Challenge: Given two five-card hands, determine which one wins by the standard ranking of poker hands. Input: Ten cards separated by spaces from stdin or as command line arguments, whichever you ...
commando's user avatar
  • 1,123
14 votes
11 answers
1k views

The game of Sevens! Who said what?

The game of Sevens is played as follows: n players sit in a circle, and start counting up from 1, passing to the left (or from player ...
Sherlock9's user avatar
  • 12.3k
14 votes
10 answers
3k views

Hangman wordgame golf

Inspired by reddit. Write a program which plays Hangman. The program chooses a random word from a list of N words, where N > 2. The word list can be provided to the program in any way you choose. ...
NNN's user avatar
  • 323
13 votes
2 answers
6k views

Frogger-ish game

How about giving the good ol' arcade game Frogger a revival, Code Golf-style! Your task is to create a version of this classic game, with as few characters of code as possible. Use the language of ...
display-name-is-missing's user avatar
11 votes
5 answers
1k views

Name the poker hand - 7 cards edition

The Challenge: In this question: Name the poker hand you had to take a five card poker hand and identify it. This question is similar, with two twists: First, the output will be in all lower case. ...
durron597's user avatar
  • 4,820
10 votes
10 answers
3k views

Bingo card generator

A Bingo card is five columns of five squares each, with the middle square designated "FREE". Numbers cannot duplicate. The five columns are populated with the following range of numbers: B:1-15 I:...
Phillip Senn's user avatar
8 votes
5 answers
1k views

Let's play Hangman?

According to this page, the best strategy to guess English hangman words is to calculate the odds of each letter in a word list that meet our conditions. But, as I'm really lazy, I don't really want ...
WayToDoor's user avatar
  • 469
8 votes
4 answers
2k views

Build a Simple Roguelike

This challenge is based on one proposed on the usenet group rec.games.roguelike.development a few years ago. I can't find the original newsgroup post, but you can have a look a the Github repo of ...
Paul Prestidge's user avatar
80 votes
57 answers
8k views

Score rock-paper-scissors

Given two string inputs of "Rock", "Paper", or "Scissors", determine the outcome of the RPS round. Output 1 if the first player wins, -1 if the second player wins, or 0 for a tie. ...
xnor's user avatar
  • 145k
57 votes
59 answers
6k views

Count without 3

Background When I was in elementary school, we used to play a game in math class that goes as follows. All kids sit in a big circle and take turns counting, starting from 1. However, the following ...
Dennis's user avatar
  • 210k
55 votes
9 answers
5k views

Codémon, I choose you!

Your kindly neighbour, Doctor Tree, just gave you three magical creatures called Codémon. There's a battle tournament in the nearby town of Colorville. Are you the very best, like no one ever was? ...
Geobits's user avatar
  • 19.7k
53 votes
5 answers
5k views

Create a User-Profile Mini-Game [closed]

Yesterday, I stumbled on a very clever thing. Yes, that's a working implementation of Tic-Tac-Toe on a user profile page, from @minitech. Of course, the moment I ...
mellamokb's user avatar
  • 6,103
37 votes
46 answers
6k views

Yahtzee Small Straight Detection

In the game Yahtzee, players roll five six-sided dice, and attempt to create certain hands to score points. One such hand is a small straight: four consecutive numbers, not necessarily in order. The ...
lirtosiast's user avatar
  • 21.5k
35 votes
15 answers
5k views

How much Mana do I need?

Dungeon Master was one of the first ever real-time role-playing games, originally released in 1987 on the Atari ST. Among other exciting things for the time, it offered a rather sophisticated spell ...
Arnauld's user avatar
  • 192k
35 votes
11 answers
3k views

Verify a Minesweeper board

Your goal is to check whether a completed Minesweeper board is valid. This means that each number is a correct count of mines in cells adjacent to it, including diagonals. The board does not wrap ...
xnor's user avatar
  • 145k
34 votes
13 answers
13k views

Recreate a 'Snake' game in a console/terminal

Games are fun This Code Golf here was so fun I had to make a version for other classic games similar in complexity: Shortest Way of creating a basic Space Invaders Game in Python This time, however, ...
Blazer's user avatar
  • 2,202
33 votes
15 answers
5k views

Let's play Mölkky!

Mölkky Mölkky is a Finnish throwing game. The players use a wooden pin (also called "mölkky") to try to knock over wooden pins of almost similar dimensions with the throwing pin, marked with ...
Arnauld's user avatar
  • 192k
33 votes
3 answers
30k views

Google's doodle on kids coding: shortest program solving all the levels

Today's Google doodle is about Celebrating 50 years of Kids Coding: The goal is program the path of a little bunny so that it can eat all the carrots. There are 4 types of blocks (see pictures below): ...
Surb's user avatar
  • 441
31 votes
1 answer
2k views

Magic: the Gathering Combat Golf

Magic: the Gathering is a trading card game where, among other things, players play cards representing creatures, which can then attack the other player, or defend against the other player's attacks ...
isaacg's user avatar
  • 42k
28 votes
12 answers
2k views

Letter Boxed validator

The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows: You are given 4 groups of 3 letters (...
Robin Ryder's user avatar
  • 15.6k