Skip to content

raxityo/GoBots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Go Bots!

A fun little thing to play with. One fine day, an all time Swift guy decided to build a silly game of snake to catch up with Objective-C and ended up building something else.

How does this work?

We have two hungry snakes trying to eat the green food arbitrarily placed in the Game board. Whoever gets the food first wins. If no one gets the food, the game draws. After each round, the food position resets and snakes start back from their home.

Got a Pic?

Nope, but I got a Gif!

Setup

  • Open Product/GoBots.xcworkspace in XCode.
  • Hit the beautiful Run button ▶️ and enjoy the show.

Configuration:

  • Open Constants.h
  • Tweak BOARD_SIZE to change the board size.
  • Tweak MOVE_DELAY to change delay between each opponent's move.
  • Tweak ROUNDS_DELAY to change delay between each round. A round qualifies to be condition when one of the opponent "wins" or the game has a tie.

Mess around:

  • Tap on Empty cells to move the prize token to that cell.
  • To cause a draw, try to put the token once the robot has already left. It is quite easy to cause a draw in Dijkstra Algorithm.

Algorithms:

Inspired from Great work done at https://github.com/stevennl/Snake, the attempt of this game was to avoid draws as much as possible. In the game of snake, the adjacency matrix does not change on each move and there is no external Messing Around factor involved (which I loved in this game btw); so it is quite trivial to build static path and follow along the path.

While keeping that in mind, this game is promoting pure Hamiltonian Cycle while gathering the treasure. The thing is, following a Hamiltonian Cycle is really boring. So there is another algorithm that simply constructs shortest path and feels smarter. Mess around with Constants.h and have fun.

Resources:

  • In the Resources folder located at the root of this repository contains Sketch, image and sound resources used while working on this project.

Tweet me @raxityo to say hi 👋!

© 2017 WTFPL

Releases

No releases published

Packages

No packages published