• Stars
    star
    1
  • Language
    Haskell
  • License
    BSD 3-Clause "New...
  • Created over 4 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bomberman Client

Client for a Bomberman game event. Your goal is to implement a player function in the Bomberman.Player module.

player :: ( MonadIO m
          , MonadReader r m
          , HasLogFunc r
          )
       => Board Cell
       -> m Action
player board = pure $ Action Stay BombBeforeMove

Building and running

In order to build and run this client you need to install stack. Once you have it, just run the following commands in the root of the project.

$ stack build
$ stack exec bomberman-bot -- --user [email protected] --code CODE

# or simply

$ stack build && stack exec bomberman-bot -- --user [email protected] --code CODE

If you wish to change the default server, there are --address and --port options that you can use.

Use --help option to get more information about the command line options.

bomberman-bot - enjoy the bot playing bomberman

Usage: bomberman-bot [--version] [--address VALUE] [--port NUMBER] --user VALUE
                     --code VALUE
  bomberman bot

Available options:
  -h,--help                Show this help text
  --version                Show version
  --address VALUE          Override default address
  --port NUMBER            Override default port
  --user VALUE             Set the user
  --code VALUE             Set the code

Docker

One can also build and run the client using docker.

$ docker build .
$ docker run -e [email protected] -e code=CODE

Writing the bot

player :: ( MonadIO m
          , MonadReader r m
          , HasLogFunc r
          )
       => Board Cell
       -> m Action

The player function takes the current Board and returns an Action - combination of Move command (stay or move to one of the Direction) and Bomb command (do nothing, place a bomb before the move or place a bomb after the move).

The Board datatype is more interesting. Under the hood, itโ€™s just a two-dimensional variant of the pointed lost (Universe a), which represents and element (focus), a list of elements to the โ€˜leftโ€™ of the focus and a list of elements to the โ€˜rightโ€™ of the focus. Think of an endless tape with a focus. You can shift it to either of the sides (left/right). Universe a is polymorphic. Now if you put another Universe as element, you get two-dimensional Universe. Board in a nutshell is just an Universe (Universe a).

The great thing about Universe (and Board in particular) is that itโ€™s a Functor and Comonad. This gives an ability to nicely evaluate the game board. Just take a look at mark function. If you have questions, just ask @d12frosted.

Monad here is present for two reasons:

  1. allow usage of random (requires MonadIO),
  2. allow usage of logging (MonadReader with HasLogFunc).

More Repositories

1

homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
Ruby
2,143
star
2

vulpea

A collection of functions for note taking based on `org` and `org-roam`.
Emacs Lisp
222
star
3

flyspell-correct

Distraction-free words correction with flyspell via selected interface.
Emacs Lisp
196
star
4

environment

dotfiles
Emacs Lisp
121
star
5

elpa-mirror

Mirror for some Emacs package archives
Emacs Lisp
96
star
6

dotbot-brew

Install brew packages using dotbot
Python
42
star
7

vino

It's your cellar, your dear cantina.
Emacs Lisp
36
star
8

counsel-osx-app

Launch OSX applications via ivy interface
Emacs Lisp
24
star
9

UnityLibrarySwitcher

Unity plugin for switching build targets, git branches without endless assets reimport. Not maintained anymore.
C#
19
star
10

git-config-manager

Manage git repository configurations with ease
Haskell
8
star
11

mirror-elpa

(To) mirror Emacs Lisp Package Archive(s)
Shell
8
star
12

d12frosted.io

Personal site
Haskell
8
star
13

orgability

Reading list manager for Emacs with offline access support.
Emacs Lisp
7
star
14

publicatorg

Make your vulpea notes public
Emacs Lisp
5
star
15

fancy-yank

apply transformation upon yanking
Emacs Lisp
4
star
16

emacs-addiction-mode

M-x doctor instead of C-x C-c
Emacs Lisp
4
star
17

barberry.io

Emacs Lisp
4
star
18

emacs-ukrainian-input-method

Ukrainian macOS-like input method
Emacs Lisp
4
star
19

org-drawer-list

Tame your lists in a drawer
Emacs Lisp
3
star
20

emacs-plus-basis

Emacs Lisp
3
star
21

CanonicalPath

Abstract data type for canonical paths with some pretty operations. Not maintained anymore.
Haskell
3
star
22

env-extra

Safe helpers for accessing and modifying environment variables
Haskell
2
star
23

talks

TeX
2
star
24

d12frosted

1
star
25

path-extra

Path helpers for my personal projects
Haskell
1
star
26

fish-mode

Major mode for editing fish shell scripts
Emacs Lisp
1
star