purpose of codefights prove that you are better developer. testers sometime win as well… coding...

22

Upload: lorena-lambert

Post on 17-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Purpose of CodeFights

• Prove that You are better developer.• Testers sometime win as well…• Coding can be fun too.

History

Supported languages

• Java• PHP• C#• Javascript• More to come…

Basics

• Single Fighter Class• 3 actions per Move (Round)• Attacking / Blocking• Order doesn’t matter• 150 hit points

Attack areas and Points

• Area::NOSE – 10 pts• Area::JAW – 8 pts• Area::BELLY – 6 pts• Area::GROIN– 4 pts• Area::LEGS – 3 pts

MyFighter Class

• Class must implement IFighter interface• Method makeNextMove must return Move object• Each round makeNextMove is called with

these params:• opponentsLastMove (except first round)

• myLastScore

• opponentsLastScore

Move API

• addAttack(AREA::X)• addBlock(AREA::X)• getAtacks()• getBlocks()

Sample Class

Javascript fighter

Points calculation (1)

Attack Nose

Attack Groin

Block Legs

+10 pt +4 pt

14 pt0 pt

Block Groin

Attack Legs

Attack Legs

0 pt +3 pt

6 pt+3 pt

Points calculation (1)

Attack Nose

Attack Groin

Block Legs

+10 pt +4 pt

10 pt0 pt

Block Groin

Attack Legs

Attack Legs

0 pt +3 pt

0 pt+3 pt

Points calculation (2)

Attack Groin

Attack Groin

Block Nose

+4 pt +4 pt

8 pt0 pt

Attack Nose

Attack Jaw

Attack Belly

+10 pt +8 pt

24 pt+6 pt

Points calculation (2)

Attack Groin

Attack Groin

Block Nose

+4 pt +4 pt

8 pt0 pt

Attack Nose

Attack Jaw

Attack Belly

0 pt +8 pt

14 pt+6 pt

JAVA

• Requirements: JDK 1.7• Simply execute build.bat or build.sh

C#

• Requirements: runs on mono 3.2• Build sdk project exe

PHP

• Requirements: PHP 5.4• CLI php.ini has phar.readonly flag set to

false• Command line: php box.phar build• Or simply execute build.bat or build.sh

Javacsript & NodeJs

• Requirements: NodeJs 0.10.x.• Install Node.js package:• npm install codefights.net [-g] 

Try it!

• Command line• php my-fighter.phar <fight_mode>

• java –jar my-fighter.jar <fight_mode>

• my-fighter.exe <fight_mode>

• node index.js <fight_mode>

• Fight manually (--fight-me)• Fight against sample bots Kickboxer and

Boxer (--fight-bot <bot_name>)• Enroll Your fighter to tournament!

Grab SDK and prepare fighter for tournament!

Website:codefights.net