Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is intended to be a hive game engine, as well as assets and a react client.
git clone https://github.com/chriscauley/hive.js.git
cd hive.js
yarn install
yarn develop
yarn serve
```

The above will start only the client. If you also want to run the client you will need python3 and postgres installed. You'll also need docker (or redis if you don't want to use docker). To install the python server and start both the client and multiplayer server at http://localhost:8239 run:
Expand Down Expand Up @@ -34,4 +34,4 @@ docker run -p 6379:6379 -d redis:5is:5

* minmax AI

* add more variants from board game geek
* add more variants from board game geek
4 changes: 4 additions & 0 deletions client/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [ nodejs yarn ];
}
80 changes: 79 additions & 1 deletion client/src/components/NewGame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const presets = [
},
},
{
slug: 'superhive',
slug: 'modern_hive',
description: 'Classic hive with a few tweaks',
pieces: {
ant: 3,
Expand Down Expand Up @@ -171,6 +171,84 @@ const presets = [
beetle: 2,
},
},
{
slug: 'dunes',
description: 'Tough, hard to pin pieces.',
pieces: {
beetle: 3,
praying_mantis: 1,
scorpion: 2,
fly: 1,
kung_fu_mantis: 1,
emerald_wasp: 3,
},
},
{
slug: 'swamp',
description: 'Fast moving pieces and grabbers.',
pieces: {
cicada: 3,
praying_mantis: 3,
orchid_mantis: 2,
dragonfly_nymph: 2,
orbweaver: 2,
},
},
{
slug: 'marsh',
description: 'Carrying pieces.',
pieces: {
kung_fu_mantis: 2,
lanternfly_nymph: 2,
dragonfly: 3,
cockroach: 2,
praying_mantis: 2,
},
},
{
slug: 'attic',
description: 'Pesky flies.',
pieces: {
beetle: 1,
scorpion: 1,
orbweaver: 1,
fly: 4,
beetle: 1,
damselfly: 3,
ant: 2,
},
},
{
slug: 'frenzy',
description: 'Quick attackers.',
pieces: {
hornet: 3,
orchid_mantis: 2,
scorpion: 2,
praying_mantis: 2,
ant: 2
},
},
{
slug: 'jitters',
description: 'Emerald Wasp and other pieces that take effort to activate.',
pieces: {
emerald_wasp: 4,
orchid_mantis: 2,
cockroach: 3,
trapdoor_spider: 2,
},
},
{
slug: 'skulking',
description: '4 bugs that can counter each other.',
pieces: {
cicada: 3,
trapdoor_spider: 3,
lanternfly_nymph: 3,
beetle: 3,
},
},
]

presets.forEach((p) => (p.name = startCase(p.slug)))
Expand Down
14 changes: 14 additions & 0 deletions client/src/views/ChangeLog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import css from '@unrest/css'

const content = {
'v1.0.3 Dec 12, 2024': [
'Arachnid rebalance: Scorpion movement decreased to 2, range of stinger increased by 1. Hop ability removed.',
'Arachnid rebalance: Orbweaver movement decreased to 1. Hop ability removed.',
'NEW PIECE SET: Dunes. Tough, hard to pin pieces.',
'NEW PIECE SET: Swamp. Fast moving pieces and grabbers.',
'NEW PIECE SET: Marsh. Carrying pieces.',
'NEW PIECE SET: Attic. Pesky flies.',
'NEW PIECE SET: Frenzy. Quick attackers.',
'NEW PIECE SET: Jitters. Emerald Wasp and other pieces that take effort to activate.',
'NEW PIECE SET: Skulking. 4 bugs that can counter each other.',
'Renamed Superhive to Modern Hive, to reflect its intention as a modern balance patch.',
'Reorganized pieces in piece selection. Functionality is roughly organized in columns. Power roughly increases with each row.',
'Help text improved for accuracy, consistency, and grammar.'
],
'v1.0.2 Dec 28, 2020': [
'NEW PIECE: Praying Mantis can leap onto furthest piece in any direction and drag a stacked piece with it.',
'NEW PIECE: Kung Fu Mantis can grab a piece two spaces away and move it underneath.',
Expand Down
1 change: 1 addition & 0 deletions game/Board/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const B = {
type: {},
player: {},
stack: {},
stinger: {},
crawl: {},
fly: {},
}
Expand Down
25 changes: 21 additions & 4 deletions game/Board/moves.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ import webs from './webs'

export const notEnemyScorpion = (board, source, target) => {
const { stack, player } = board.layers
return !stack[target] || player[source] === player[target]
}
const touching = board.geo.touching[target];
const noAdjacentScorpions = touching.filter((i) => notEnemyStinger(board, source, i)).length === 6;

return noAdjacentScorpions && (!stack[target] || player[source] === player[target])
} //confused how this works to identify not a scorpion

export const notEnemyStinger = (board, source, target) => {
const { stinger, player } = board.layers

return !stinger[target] || player[source] === player[target]
}

const getPlacement = (board, player_id, excludes = []) => {
if (board.turn === 0) {
Expand Down Expand Up @@ -352,6 +361,14 @@ const spider = (b, i) => {

const kung_fu_mantis = (b, i) => (b.stacks[i].length > 1 ? beetle(b, i) : [])

const orbweaver = (b, i) => {
return nStepsAlongHive(b, i, 1);
}

const scorpion = (b, i) => {
return nStepsAlongHive(b, i, 2);
}

const moves = {
stepOnHive,
stepOffHive,
Expand All @@ -378,9 +395,9 @@ const moves = {

// all spider-likes move the same
spider,
scorpion: spider,
scorpion: scorpion,
trapdoor_spider: spider,
orbweaver: spider,
orbweaver: orbweaver,
emerald_wasp,
kung_fu_mantis,
}
Expand Down
4 changes: 3 additions & 1 deletion game/Board/specials.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ const praying_mantis = (board, piece_id, args) => {
}
target_index += dindex
}
targets.push([last, snag])
if (!board.layers.stinger[last]) {
targets.push([last, snag])
}
})
if (args.length === 0) {
let snag_targets = []
Expand Down
4 changes: 4 additions & 0 deletions game/Board/webs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const web_targets = {
fly: ['fly', 'hornet', 'ladybug', 'cockroach', 'grasshopper', 'cicada', 'lanterfly'],
crawl: ['ant', 'cicada'], // , 'orbweaver', 'scorpion', 'trapdoor_spider', 'spider'],
stack: ['beetle', 'orchid_mantis', 'praying_mantis', 'fly', 'dragonfly'],
stinger: ['beetle', 'orchid_mantis', 'praying_mantis', 'fly', 'dragonfly'], //includes damsel fly
}

const piece_shows_webs = {}
Expand All @@ -20,6 +21,7 @@ export default {
scorpion: (b, i) => {
// no piece can step on top of a scorpion
b.layers.stack[i] = true
b.layers.stinger[i] = true
},
orbweaver: (b, i) => {
// no piece can fly over an orbweaver
Expand All @@ -38,6 +40,7 @@ export default {
fly: (b, i) => !b.layers.fly[i],
crawl: (b, i) => !b.layers.crawl[i],
stack: (b, i) => !b.layers.stack[i],
stinger: (b, i) => !b.layers.stinger[i]
},

getVisible(b, i) {
Expand All @@ -56,5 +59,6 @@ export default {
`Since the ${type} started in this web, it cannot be stuck on it again.`,
stack: (type) => `The ${type} cannot step on top of the scorpion.`,
fly: (type) => `The ${type} cannot move over the orbweaver.`,
stinger: (type) => `The ${type} cannot move within the scorpion's stinger range.`,
},
}
6 changes: 3 additions & 3 deletions game/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const _spider = (s, e = '') => `The ${u(s)} must crawl exactly 3 spaces along th
const queen = [_along('queen')]

const emerald_wasp = [
'If starting on the ground, the emerald wasp can take two steps on top of the hive',
'If starting on the hive, the emerald wasp can step off the hive',
'If starting on the ground, the emerald wasp can take two steps on top of the hive.',
'If starting on the hive, the emerald wasp can step off the hive.',
_orbweaver('emerald_wasp'),
_scorpion('emerald_wasp'),
]
Expand Down Expand Up @@ -87,7 +87,7 @@ const kung_fu_mantis = [

const praying_mantis = [
'If starting on the ground, the praying mantis leaps in any direction and lands on the furthest piece.',
'It cannot leap over any breaks in the hive',
'It cannot leap over any breaks in the hive.',
'If the mantis encounters any stacks while leaping, it will carry the top most piece with it.',
'If starting on top of a stack, the mantis can only step off the stack onto the ground.',
_orbweaver('praying_mantis'),
Expand Down
34 changes: 16 additions & 18 deletions game/pieces.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@ const VANILLA = {
spider: 2,
}

//sorted for vertical roguh functionality groupings
const piece_counts = {
queen: 1,
...VANILLA,
// expansion
ladybug: 1,
mosquito: 1,
pill_bug: 1,

// boardgamegeeks
orchid_mantis: 2,
fly: 3,
hornet: 3,
dragonfly: 1,
cicada: 3,
cockroach: 1,
trapdoor_spider: 2,
centipede: 1,
dragonfly: 1,
praying_mantis: 1,
lanternfly: 3,
scorpion: 2,

// hive.js
trapdoor_spider: 2,
ladybug: 1,
dragonfly_nymph: 2,
kung_fu_mantis: 1,
fly: 3,
orbweaver: 2,
cicada: 3,
lanternfly: 3,
lanternfly_nymph: 3,
earthworm: 1,
emerald_wasp: 1,
damselfly: 1,
dragonfly_nymph: 2,
earthworm: 1,
hornet: 3,
praying_mantis: 1,
emerald_wasp: 1,
kung_fu_mantis: 1,
lanternfly_nymph: 3,
mosquito: 1,

}

// currently not used, colors are stored on svg
Expand Down
25 changes: 14 additions & 11 deletions game/short_help.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const _along = 'Move one square along the hive.'
const _along = 'Move one space along the hive.'
const _stack = 'Cannot step on scorpion.'
const _fly = 'Cannot move over orbweaver.'
const _crawl = 'Will stop moving if it touches the trapdoor spider.'
Expand All @@ -7,7 +7,7 @@ const _beetle = 'Moves like a beetle if it starts a turn on the hive.'

const queen = [_along, 'If surrounded, you lose.', 'You can only have one queen.']
const beetle = [_along, 'Can move onto hive.', _stack]
const grasshopper = ['Hops over hive.', _fly]
const grasshopper = ['Jumps over the hive.', _fly]
const cicada = ['Can make unlimited jumps over the hive.', _fly, _crawl]
const spider = _spiderlike([])
const ant = ['Can move unlimited spaces along the hive.', _crawl]
Expand All @@ -17,24 +17,24 @@ const mosquito = [
_beetle,
'Cannot copy special abilities.',
]
const pill_bug = [_along, 'Can move any piece it is touching to another empty square.']
const pill_bug = [_along, 'Can move any piece it is touching to an empty adjacent space.']
const orchid_mantis = [_along, 'Can pull a piece under itself.', _beetle, _stack]
const kung_fu_mantis = [
'Can pull a piece two spaces in any direction under itself.',
'Can pull a piece from two spaces in any direction under itself.',
_beetle,
_stack,
]

const praying_mantis = [
'Can jump over the hive and land on the furthest piece in any direction',
'Will carry a stacked piece with it when it jumps.',
'If on the hive, can only step on the ground.',
'If on the hive, can only step to the ground.',
_fly,
_stack,
]
const fly = [
'If on ground, can step on the hive.',
'If on the hive, can fly to any open square.',
'If on the hive, can fly to any open tile.',
_fly,
_stack,
]
Expand All @@ -54,22 +54,25 @@ const dragonfly_nymph = [
]
const centipede = [_along, 'Can swap with an adjacent piece.']
const earthworm = [_along, 'Can swap with the bottom piece of any stack 3 (on hive) moves away.']
const orbweaver = _spiderlike([
const orbweaver = [
'Moves one step along the hive',
'No piece can move over.',
'Defends against grasshopper, cicada, ladybug, fly, hornet, emerald wasp, and cockroach.',
])
]

const trapdoor_spider = _spiderlike([
'Traps any piece that moves next to it.',
'Defends against ant and cicada.',
])
const scorpion = _spiderlike([
const scorpion = [
'Moves two steps along the hive.',
'No piece can stack on top of the scorpion.',
'Defends against beetle, fly, dragonfly, and orchid mantis, kung fu mantis, and praying mantis.',
])
]

const emerald_wasp = [
'If on the ground, can take two steps onto the hive.',
'If on the hive, can only step on the ground.',
'If on the hive, can only step to the ground.',
_fly,
_stack,
]
Expand Down