5,442,164 members and growing! (19,201 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Game Development » Games     Intermediate

The boardgame Twix with a twist

By Alex A. Miller

This is a strategy board game that I used to enjoy playing with my neighbour when I was a teen in the 80's that I developed in Java, then ported to C#.
C#, Windows, .NET 1.1, .NET, GDI+, Visual Studio, VS.NET2003, Dev

Posted: 19 Oct 2004
Updated: 19 Oct 2004
Views: 23,796
Bookmarked: 5 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
6 votes for this Article.
Popularity: 1.99 Rating: 2.56 out of 5
2 votes, 33.3%
1
1 vote, 16.7%
2
1 vote, 16.7%
3
0 votes, 0.0%
4
2 votes, 33.3%
5

Introduction

This is my first contribution to CodeProject! Twix is a strategy board game that was played on a square plastic board containing a grid of holes for pegs with which you connect bridges.

There are two players in this game who would try to connect an uninterrupted bridge from one edge of the board to the opposite edge of the board. One of the players attempts to connect the left and right edges, while the other tries to do the same with the top and bottom edges. Inevitably there is conflict and therein lies the strategy of the game.

Players take turns placing pegs onto the grid. When two pegs are in a grid position of one-over and two-away (like a knight in chess moves) a bridge may be placed atop the pegs. Bridges may not cross other bridges! Each peg may have up to eight bridges connected with pegs surrounding it that are placed in the 'valid' grid holes.

Every time a player places a peg, the peg is analyzed to determine if any bridges should be placed (up to eight). It is not necessary to place a peg in any potential bridge location i.e.. it is not necessary to place bridges and connect pegs in every turn.

Bridges are placed on like-colored pegs. Bridges may not cross other bridges and will not be allowed.

Some enhancements I have made:

  • Timer to enforce that player must make a move or forfeit their turn.
  • A credit system based on time and new bridges that reward a quick player move.
  • A creature is awarded to a player who has accumulated enough points (The cursor will change to indicate that a creature may be launched). This creature is assigned a location on the board (an opponent's peg in a strategic location is a good one). The creature will work its way over to that location, and if a peg is there, will grab it and relocate it to an empty grid position.

Code discussion

The reasons I undertook this project:

  • It was a cool game that I can't find anymore.
  • It was an interesting problem to solve.
  • It was a good starting platform to introduce a useful playing field for my creature object.

The trickiest part of developing this game was the bridge connection/blockage detection. The next difficult problem was the win condition detection. The latter required recursion, the former required a lot of boundary checking and thoughtful looping.

The creature is a specialty of mine that I came up with almost ten years ago. It learns how to migrate towards a coordinate by randomly flailing its appendages until a 'good' move is determined. A good move is one where its elbow and its feet are closer to the destination than its current elbow and feet configuration. Then the creature iterates through the two configurations repeatedly (extending its arms, grabbing with its feet, and extending and contracting its elbow) until its destination is reached, or its distance from the destination increases. I'm very proud of this little guy and finally found an interesting use for it in a game.

The game is run by a timer in the main windows form. Every time the timer event occurs, a set of list objects is called upon to do work. There is an explosion list, an arm list, a peg list (which contain bridge lists) and the board object. The graphics is page flipped to provide a smooth look.

Crack open Globals.cs to change the board size, the speed of the creatures, their spawn rate in demo mode, etc..

Desired future enhancements

  • Sound!! Nice ambient background and a heartbeat that increases as the players get closer to winning would be cool. Explosion sounds, creature walking sounds, grabbing sounds, etc..
  • Computer AI for one player mode.
  • Two players over the network would be awesome, but a significant and possibly difficult restructuring of the code is required.
  • More interesting events and sub-goals for players to strive for (enclosing something causes something to occur, etc.)
  • Port to DirectX, DirectSound, DirectPlay.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Alex A. Miller


Masters Computer Science Rochester Institute of Technology
B.S. Computer Science at Oswego State University of New York
Occupation: Web Developer
Location: United States United States

Other popular Game Development articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 4 of 4 (Total in Forum: 4) (Refresh)FirstPrevNext
Subject  Author Date 
GeneraltwixsussAnonymous11:17 23 Oct '05  
GeneralRe: twixmemberAlex A. Miller4:17 24 Oct '05  
GeneralCode In Javamembernfwu2:36 25 May '05  
GeneralRe: Code In JavamemberAlex A. Miller5:47 25 May '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 19 Oct 2004
Editor: Rinish Biju
Copyright 2004 by Alex A. Miller
Everything else Copyright © CodeProject, 1999-2008
Web12 | Advertise on the Code Project