DarthStrom / BlackBox

Source code for Black Box Battle game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Black Box

Overview

  • One player hides balls, the other tries to find them
  • Four balls are hidden on an 8x8 grid by the hider
  • The seeker uses imaginary rays to get information on where the balls are hidden
  • The computer is the hider in the 1-player game
  • Players take a turn at each role in the 2-player game
  • The object is to find the hidden balls in as few tries as possible

Rays

  32 31 30 29 28 27 26 25
 ╔══╤══╤══╤══╤══╤══╤══╤══╗
1║  │  │  │  │  │  │  │  ║24
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
2║  │  │  │  │  │  │  │  ║23
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
3║  │  │  │  │  │  │  │  ║22
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
4║  │  │  │  │  │  │  │  ║21
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
5║  │  │  │  │  │  │  │  ║20
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
6║  │  │  │  │  │  │  │  ║19
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
7║  │  │  │  │  │  │  │  ║18
 ╟──┼──┼──┼──┼──┼──┼──┼──╢
8║  │  │  │  │  │  │  │  ║17
 ╚══╧══╧══╧══╧══╧══╧══╧══╝
   9 10 11 12 13 14 15 16
  • Entry points are numbered 1 to 32 starting on the uppermost left and going counter-clockwise
  • Rays can:
    • Stay in the box (Hit)
    • Exit back out the way they came (Reflection)
    • Exit somewhere else (Detour)

Ray Movement

Hit: The ray travels into a ball.

──────O

Detour: Rays change direction (90 degrees) to avoid passing by a ball.

    O
───┐
   │

Reflection: The ray comes back out the way it came. This can happen by being deflected before it enters.

   ║O
 ─┐║
   ║

It can also happen by being deflected by two balls at once.

      O
──────
      O

Marks

When a ball exits the box, it is marked.

  • A hit is marked with red on its entry point
  • A reflection is marked with yellow on its entry point
  • A detour is marked with matching white symbols on the entry point and the exit point

Special cases

If a ray encounters one ball straight on and one to the side, it counts as a hit.

──────O
      O

If a ray encounters three balls, it counts as a hit.

      O
──────O
      O

Multiple detours

A ray can be detoured many times... this can be misleading for the seeker.

      O
─────┐
     │
  O  │
   ┌─┘
   │  O

Gameplay

  1. The hider marks the locations of the hidden balls
  2. The seeker looks for hidden balls by sending in rays from different entry points
  3. The seeker marks balls as they are found
  4. Marked balls may be moved if further clues indicate that the placement may not be correct
  5. When the seeker is finished guessing, the game is scored
    • 1 point for each ray used
    • 5 points for each incorrect ball

Winning

When both players have played then the player with the lowest score is the winner.

In the case of a single player game, the score is compared with a predetermined "par" score for the given ball placement.

About

Source code for Black Box Battle game

License:MIT License


Languages

Language:Swift 99.5%Language:C 0.5%