Code Monkey home page Code Monkey logo

battle-royal-game's Introduction

Battle Royal Game

Move

In the function move I computed the new coords and I checked if player has enough stamina to make the move. If an elf meets another one they will fight using the following condition: if an elf A fights and elf named B the hits needed to kill A are (A.hp + B.dmg - 1) / B.dmg and the hits needed to kill B are (B.hp + A.dmg - 1) / A.dmg so if A starts the hits needed to kill B remains (B.hp + A.dmg - 1) / A.dmg - 1. The winner is the one who needs fewer hits to kill the other one.

Snowstorm

For snowstorm I extracted the data from that package and for all players alive on the glacier affected by the snowstorm I updated theirs hp.

Scoreboard

To print the scoreboard I sorted indexes of elfs stored in an auxilliary array by required criteria (dry/wet, eliminated, lexicographically) with bubble sort.

Meltdown

For meltdown I reallocated memory to keep only the current glacier. Also I kept track of meltdown operations executed. For the others functions I took into account that indexes are shifted "meltdowns" positions to North-West.

Data storage and miscellaneous

I stored data in two structures, one for elfs and one for glacier. I allocated dinamically the elfs array, their names and the glacier bidimensional array. At the end of program I released all the memory used. For best precision I used distances squared, to keep the variables integers.

battle-royal-game's People

Contributors

raduleo19 avatar

Watchers

James Cloos avatar  avatar

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.