Today - Amazon S3s3.amazonaws.com/battlecode-releases/lectures/Lecture_1_BattleCode_2011.pdf ·...

Post on 16-Mar-2020

1 views 0 download

Transcript of Today - Amazon S3s3.amazonaws.com/battlecode-releases/lectures/Lecture_1_BattleCode_2011.pdf ·...

Today

• Administrivia

• Why Battlecode?

• New Features

• How to Win

AdministriviaTeh Devs

• Ben Frenkel

• Dan Gulotta

• Trevor Rundell

• Joel Stein

• Andrew Sugaya

• Aleks Tamarkin

AdministriviaContact Info/Bug Reports

• Website - battlecode.org

• Email - battlecode@mit.edu

• IRC - #battlecode on freenode

• Forum Posts - battlecode.org

AdministriviaSchedule

• Register for 6.187

• Lectures @ 12:30pm in 34-101

AdministriviaTournaments

• Sprint - Monday, Jan 10 @ 3pm in 34-401b

• Seed - Tuesday, Jan 18 @ 3pm in 34-401b

• Qualifying - Tuesday, Jan 25 @ 3pm in 34-401b

• Final - Saturday, Jan 29 @ 7pm in Kresge

Why BattleCode?

Why BattleCode?Fame

Why BattleCode?Fortune

Why BattleCode?Fun

Why BattleCode?Eternal Glory

Why BattleCode?Preparation for World Domination

What’s New?

Units (2010 Battlecode)

• Archon

• Wout

• Soldier

• Chainer

• Turret

Units (2010 Battlecode)

• Archon

• Wout

• Soldier

• Chainer

• Turret

Modular Robots(Build-a-bot)

Chassis(The Body)

Components(The Guts)

Chassis + Components(The Robot)

ChassisTypes

• Light

• Medium

• Heavy

• Flying

• Building

ChassisLight

Low HitpointsLow Weight Cap

High Speed

ChassisMedium

Medium HitpointsMedium Weight Cap

Medium Speed

ChassisHeavy

Very High HitpointsHigh Weight CapVery Low Speed

ChassisFlying

Low HitpointsLow Weight Cap

High Speed

ChassisBuilding

High HitpointsVery High Weight Cap

No Speed

ComponentsTypes

• Armors

• Weapons

• Sensors

• Broadcast

• Misc

• Macro

Armors(Defense)

ArmorsShield

Reduces Damage

ArmorsHardened

Caps Max Damage Taken

ArmorsRegenerative

Regenerates Hitpoints

ArmorsPlasma

Blocks Some Attacks

ArmorsIron

Become Temporarily Invincible

ArmorsPlating

Increases Hitpoints

Weapons(Offense)

WeaponsSMG

Low DamageHigh SpeedHigh Range

WeaponsBlaster

Medium DamageMedium SpeedMedium Range

WeaponsRailgun

High DamageMedium SpeedMedium Range

WeaponsHammer

Low DamageVery Fast Speed

Low Range

WeaponsBeam

Increasing AttackMedium Speed

High Range

WeaponsMedic

Heals

Sensors(Sensing)

SensorsSatellite

High Range360°

Can Sense Other Robots’ Components

SensorsTelescope

Very High Range45°

SensorsRadar

Medium Range180°

SensorsSights

Low Range90°

Broadcast(Communications)

BroadcastAntenna

Low Range

BroadcastDish

Medium Range

BroadcastNetwork

High Range

Misc(Misc)

MiscProcessor

3000 Bytecode Bonus

MiscJump

Teleportation

MiscDummy

Create Immobile Chassis Dummies

MiscBug

Gain Another Robot’s Sensing Range

MiscDropship

Carry Other Units

Macro(Construction)

MacroConstructor

Constructs Other Macros

MacroRecycler (Building)

Place on MinesGathers ResourcesMakes Constructors

MacroFactory (Building)

Makes Stuff

MacroArmory (Building)

Makes Other Stuff

Resources(How will you afford your army?)

$Flux++

$FluxHow to

• Build Recyclers on Mines

$FluxHow to

• Build Recyclers on Mines

• Mines become less efficient once depleted

$FluxHow to

Map Mechanics

• 10-50 Mines

Map Mechanics

• 10-50 Mines

• Blocks (5x Building Hitpoints)

Map Mechanics

• 10-50 Mines

• Blocks (5x Building Hitpoints)

• No Elevation

Map Mechanics

• 10-50 Mines

• Blocks (5x Building Hitpoints)

• No Elevation

• 25x25 Min Map Size

Map Mechanics

• 10-50 Mines

• Blocks (5x Building Hitpoints)

• No Elevation

• 25x25 Min Map Size

• 60x60 Max Map Size

Map Mechanics

Robot Mechanics

• Upkeep (Determined by Chassis)

Robot Mechanics

• Upkeep (Determined by Chassis)

• 3000 Bytecodes

Robot Mechanics

• Upkeep (Determined by Chassis)

• 3000 Bytecodes

• Activation/Deactivation of Robots

Robot Mechanics

How to Win

• Destroy

How to Win

• Destroy All of Opponent’s Active Units

Specs!(battlecode.org)

How to Win

How to Win

• Write Good Code

How to Win

• Write Good Code

• SVN / Git

How to Win

• Write Good Code

• SVN / Git

• Teamwork

How to WinWriting Good Code

package team000;

import battlecode.common.*;

import static battlecode.common.GameConstants.*;

public class RobotPlayer implements Runnable{

private final RobotController myRC;

public RobotPlayer(RobotController rc){

myRC = rc;

}

public void run(){

//Main while loop

}

}

How to WinWriting Good Code

package team000;

import battlecode.common.*;

import static battlecode.common.GameConstants.*;

public class RobotPlayer implements Runnable{

private final RobotController myRC;

public RobotPlayer(RobotController rc){

myRC = rc;

}

public void run(){

//Main while loop

}

}

How to WinWriting Good Code

if (hitpoints low){

run

} else {

find enemy

}

How to WinWriting Good Code

if (hitpoints low){

run

} else {

find enemy

}

How to WinWriting Good Code

if (hitpoints low){

run

} else {

if (enemy in sight) {

attack enemy

} else {

find enemy

}

}

How to WinWriting Good Code

if (hitpoints low){

run

} else {

if (enemy in sight) {

attack enemy

} else {

find enemy

}

}

How to WinWriting Good Code

if (hitpoints low){

if (enemy adjacent) {

attack enemy

} else {

run

}

} else {

if (enemy in sight) {

attack enemy

} else {

find enemy

}

}

How to WinWriting Good Code

if (hitpoints low){if (enemy adjacent) {

attack enemy} else {

if (lost){deactivate //COMMENT!

} else {run

}}

} else {if (enemy in sight) {

attack enemy} else {

if (useless){deactivate

} else {find enemy

}}

}

How to WinWriting Good Code

How to WinWriting Good Code

• Use Abstractions

How to WinWriting Good Code

• Use Abstractions

• Avoid Code Duplication

How to WinTeh Secret

How to WinTeh Secret

• Test Code (Unit Tests)

How to WinTeh Secret

• Test Code (Unit Tests)

• Comment Code

How to WinTeh Secret

• Test Code (Unit Tests)

• Comment Code

• Test Code

How to WinTeh Secret

• Test Code (Unit Tests)

• Comment Code

• Test Code

• Comment on Comments

How to WinSVN / Git

Repository• Central Code Repository

How to WinSVN / Git

• Central Code Repository

• Update and Commit

Repository

^_^ ^_^

How to WinSVN /Git

Repository

^_^ ^_^

Happy.

How to WinSVN /Git

Repository

^_^x_x

Sad.

How to WinSVN /Git

Repository

x_x ^_^

• Update before you Commit

How to WinSVN/Git

• Update before you Commit

• Test Code before Commit

Repository

x_x ^_^

How to WinSVN - The Usual Story

1. Update Code ^_^

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code

2. Compile^_^

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

-_-

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

-_- zzz

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

5. Finish Compiling!

!^_^!

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

5. Finish Compiling!

6. Error!

!x_x!

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

5. Finish Compiling!

6. Error!

7. Anger

!x_x!

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

5. Finish Compiling!

6. Error!

7. Anger -> Hate

!X_X!

Repository

^_^

How to WinSVN - The Usual Story

1. Update Code2. Compile

3. Compile

4. Compile

5. Finish Compiling!

6. Error!

7. Anger -> Hate -> Suffering

!X_X!

Repository

x_x

What Went Wrong?

What Went Wrong?Repository had broken code.

Always Test Before you Commit.

Noob Mistakes

x_x x_x

x_x

Noob Mistakes

• Thinking this is: x_x x_x

x_x

Noob Mistakes

• Thinking this is:

• Starcraft

x_x x_x

x_x

Noob Mistakes

• Thinking this is:

• Starcraft

• Starcraft 2

x_x x_x

x_x

Noob Mistakes

• Thinking this is:

• Starcraft

• Starcraft 2

• Worrying About Large Scale Performance

x_x x_x

x_x

Noob Mistakes

• Thinking this is:

• Starcraft

• Starcraft 2

• Worrying About Large Scale Performance

• Not Reading the Specs

x_x x_x

x_x

Noob Mistakes

• Thinking this is:

• Starcraft

• Starcraft 2

• Worrying About Large Scale Performance

• Not Reading the Specs

• Starting Too Late

x_x x_x

x_x

How to WinTeamwork

^_^ ^_^

^_^

How to WinTeamwork

• Communication^_^ ^_^

^_^

How to WinTeamwork

• Communication

• Be Realistic

^_^ ^_^

^_^

How to WinTeamwork

• Communication

• Be Realistic

• Set Goals and Be Accountable

^_^ ^_^

^_^

How to WinTeamwork

• Communication

• Be Realistic

• Set Goals and Be Accountable

• Code Together

^_^ ^_^

^_^

How to WinTeamwork

• Communication

• Be Realistic

• Set Goals and Be Accountable

• Code Together

• Be Happy and Have Fun

^_^ ^_^

^_^

• Website - battlecode.org

• IRC - #battlecode on freenode

• Forum Posts

• Email - battlecode@mit.edu

• Website - battlecode.org

• IRC - #battlecode on freenode

• Forum Posts

• Email - battlecode@mit.edu