Kotevode / club-fighters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClubFighters

A turn-based fighting with Ethereum backend.

Given player1, player2 with HP1, HP2

Fighting process:

  • At the first turn player0 submits DE1 = sha256(name(D1) + S1) where:
    • D1 - defence action (BlockHead, BlockBlody, StepBack etc.)
    • name(a) - function that returns name of action
    • S1 - random string
  • At the second turn player2 submits (DE2, A2) where:
    • A2 - attack action (KickHead, PunchBody etc.)
  • At every i > 2 turn player(i mod 2) + 1 submits (Di - 2, Si - 2, DEi, Ai). If sha256(name(Di - 2) + Si - 2) = DEi - 2 then (HP1, HP2) += resolve(DEi - 2, Ai - 1) where:
    • resolve(D, A) - calculates HP changing produced by action A defenced by action D.
  • The fight stops when HP1 or HP2 reaches zero.

About


Languages

Language:JavaScript 95.2%Language:HTML 4.8%