Skip to content

Ruby gem for creating boardgame / tile game abstractions.

Notifications You must be signed in to change notification settings

MauricioRibeiroA/boardgame

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby 'boardgame' Gem

This library provides three classes for controlling logic in board games.

  • Create, move and track game pieces across tiles on a board
  • Automatic validation and boundary checking

Installation

  1. gem install boardgame
  2. require 'boardgame'
  3. See usage instructions below

##Creating boards, pieces and tiles

require 'boardgame'
# Create a 5x5 map.
map    = BoardGame::Map.new(5, 5)

# Get tiles
home_tile = map[2, 2]
# => #<BoardGame::Tile 0x123>

# Make a game piece
knight = BoardGame::Piece.new

#Put a piece on the board
home_tile << knight

#Move the game piece
knight.move_to map[0, 0]

#remove from the board
map[0, 0].remove(knight)

About

Ruby gem for creating boardgame / tile game abstractions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 59.1%
  • CSS 33.8%
  • Ruby 7.1%