Giter VIP home page Giter VIP logo

homeworlds's Introduction

Homeworlds

This is a C++ framework for working with the game of Binary Homeworlds, a two-player game of strategy and tactics that might aptly be described as "space chess". Homeworlds is normally played with a set of Icehouse pieces in four colors, and without a board; the pieces shift on and off the table during the game to represent star systems and spaceships. The goal of the game is to eliminate all of the ships defending your enemy's homeworld: by moving in a larger ship to capture them, by sending in fleets of the appropriate colors to catastrophe them, or by sending in those fleets to catastrophe the enemy's binary star system itself.

Components

This project consists of five main components:

C++14 library code in core-src/

This poorly structured library includes C++ data structures for SingleAction, WholeMove, PieceCollection, StarSystem, and GameState. It also includes these facilities:

  • ApplyMove: apply a WholeMove to a GameState

  • AllMoves: generate all possible WholeMoves from a given GameState

  • InferMove: "fill in the blanks" in an incomplete WholeMove such as build g1, given the current GameState

  • AIMove: pick the best move from among all the possible WholeMoves following the current GameState

annotate, a command-line game analyzer

C++14 source code in core-src/.

This command-line utility brings together all of the above library code. You can use it to play a game against the computer, by alternately entering your own moves and the special command ai_move.

To run the C++ unit tests, first install GTest (instructions are here) and then run make test.

wxgui, a graphical game interface

C++14 source code in wxgui-src/.

This GUI program uses the wxWidgets library, and is my experiment with a graphical Homeworlds program. Use the mouse to drag pieces around on the board, and then click "Done" to end your turn. The program will take care of figuring out what move you made to get from A to B.

libannotate, a Python extension

Python and C++14 source code in setup.py and pythonsrc/.

This Python extension wraps up the C++ library code into a much simpler and cleaner Python module with just a few high-level entry points. Python class types are provided only for GameState and WholeMove.

import libannotate
st = libannotate.GameState('Foo (0,b3r1) g1g3-\nBar(1,b3y2) -g3')
m = st.getBestMove(0)
print (m.toString())

For more examples of usage, see pythonsrc/tests.py.

SuperDuperGames.org archive

Python source code and text files in superdupergames-archive/.

A partial mirror of the SuperDuperGames.org game archive, containing over 700 game transcripts to date. Includes a Python script to translate the archive games from SDG's format into the format expected by annotate and libannotate.

Patches wanted

Do you know how to make the wxWidgets GUI look better? Please submit a patch! If you don't want to deal with the GitHub overhead, you can send me an email.

Do you think you can make a better AI? Again, please submit a patch! I know the current AI is very weak. The major hurdle is that it's not always feasible to look more than one move ahead, unless you can figure out how to prune bad moves. Homeworlds has a much higher branching factor than either chess or go. Another hurdle is that my internal representations of game states and actions are fairly verbose and hard to manipulate (in terms of CPU cycles).

External links

This project is not affiliated with SuperDuperGames.org, BoardGameGeek.com, or Looney Labs.

homeworlds's People

Contributors

quuxplusone avatar wduminy avatar

Stargazers

Banin Rostam khoramian  avatar  avatar  avatar Nissi Nassime avatar GAURAV avatar  avatar Chase Million avatar Anthony Kozar avatar Charles Zinn avatar David L. Willson avatar Joan CiberSheep avatar Jean-François Trân avatar Erik Svedäng avatar Fogus avatar Jeff Caulfield avatar  avatar g. nicholas d'andrea avatar Christopher Mayfield avatar Bill Shirley avatar Paul Morganthall avatar

Watchers

 avatar James Cloos avatar Chatchai Daecha avatar David L. Willson avatar  avatar Nissi Nassime avatar

homeworlds's Issues

../src/gtk/window.cpp(5243): assert ""Assert failure"" failed in GTKSendPaintEvents(): unsupported background style

I compiled wx-gui, but as soon as I run it, I receive the following assertion error:
../src/gtk/window.cpp(5243): assert ""Assert failure"" failed in GTKSendPaintEvents(): unsupported background style

The traceback doesn't give any particularly helpful information.

I compiled the program with g++ 11.3.1 on Fedora Linux 35. I have wxBase-devel and wxGTK-devel both installed, both version 3.1.5. Should the program be compiled against an older version of wx? Fedora has 3.0.5 in the repositories.

Thanks! The C++ annotate program works great (I lost my first Homeworlds game!), but it would be great to have the graphic interface.

No menu/shortcut keys don't work on OS X 10.7

I'm using Homebrew on Mac OS X 10.7. After installing wxmac, Homeworlds will compile and run, but it's missing the menu and shortcut keys don't work. There are no errors in the terminal window.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.