Cody

Problem 776. TRON strategy toggle

Detect whether your lightcycle is on same side of existing walls as opponents lightcycle. This function is useful in toggling a tron algorithm from agressive/strategic mode (chasing and hassling opponent) to passive/efficiency mode (wherein you'd presumably focus on using up remaining space, and wouldn't have to bother tracking opponent, etc.). Inspired by Alfonso Nieto-Castanon's Problem 327, as well as Richard Zapor's followups.

input: 50 by 50 matrix of lightcycle and wall positions, empty space = 0, lightcycles = 1 & 2, outer walls = -3, lightcycle trails/walls = -1 and -2.

output: true if on same side, or false if no path exists between the two light cycles.

Solution Stats

71.43% Correct | 28.57% Incorrect
Last solution submitted on Apr 18, 2016

Problem Comments

Solution Comments

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more