en	Levels

en	Selfless Heroes is a game that will teach you how to program without you noticing. Solve puzzles and help your heroes emerge victorious from the dungeon!

en	Selfless Heroes is a game that will teach you how to program without you noticing. Solve puzzles and help your heroes emerge victorious from the dungeon!

en	puzzle game, video game, serious game, programming, development, puzzle, education, fun, logic, algorithm

en	Are you sure you want to leave Selfless Heroes?

en	In order to have the best game experience, it is recommended to go fullscreen.

en	Don't show this message again

en	The online version of Selfless Heroes saves your game in the browser. If you delete your history or use a cleaning utility such as CCleaner, you may delete your game.

en	To make sure you don't lose your game:

en	install Selfless Heroes

en	or save your game (%%mdi mdi-content-save-move$%%)

en	Don't show this message again

en	Exit

en	Menu

en	Join the community on Discord

en	Fullscreen

en	Fullscreen

en	Exit fullscreen

en	Music

en	Sound

en	Mute

en	Unmute

en	Language

en	credits

en	view online

en	The screen of your device is too small to play Selfless Heroes

en	Selfless Heroes is designed to work on desktop, laptop and tablet. To play this game, you must have a screen size of at least {minMaxDimension} x {minMinDimension} pixels: your screen is only {maxDimension} x {minDimension} pixels.

en	new game:

en	pseudo

en	or

en	%%mdi mdi-content-save-move$%% Load a game

en	Save as…

en	Remove

en	Are you really sure you want to delete this game? All progress will be lost.

en	Load a saved game %%mdi mdi-content-save-move$%% .shsv file

en	This file is not a valid .shsv file

en	Back

en	BONUS

en	BOSS

en	Unlock more levels

en	Premium content

en	%%content-number$3%% new level categories for a total of %%content-number$34%% additional levels

en	Heroes can calculate and write on eggs

en	Heroes can speak to each other

en	Heroes can clone themselves

en	back

en	unlock premium content

en	Unlock premium content

en	get activation key

en	activation key:

en	This is not a valid activation key.

en	Congratulations! You've successfully unlocked Selfless Heroes premium content.

en	play

en	Play

en	back

en	Back

en	New solution

en	Duplicate

en	copy

en	Delete

en	Rename

en	name

en	Are you really sure you want to delete this solution?

en	ok

en	cancel

en	Close

en	yes

en	no

en	Next

en	It is advisable to follow this tutorial carefully in order to be able to play as soon as possible. Click on the arrow to launch the tutorial.

en	The heroes follow these instructions step by step

en	Drag new instructions from here to change heroes behavior

en	To see the level objective click here

en	When your program is ready, click here to run it

en	If you need more help or want to see this tutorial again, click here

en	Undo last edit

en	Redo

en	Delete all instructions

en	Switch to code editor. Code editor can be used to copy a code from one level to another. It is also intended to be used by advanced players who want to write their program using code instead of the graphic interface.

en	Select a hero by clicking on it to better follow its behaviour. While the program is running, a blue cursor will appear to the left of the instructions to show at which step of the program the selected hero is.

en	Run or pause the program

en	Run the program step by step

en	Stop the program

en	Speed setting

en	Open the menu

en	Back to level list

en	Help

en	Objective

en	Help

en	general

en	Basic tutorial

en	Advanced tutorial

en	There are 3 stars to win per level:

en	star 1:

en	achieve the level objective

en	star 2:

en	run time secondary objective

en	To achieve this objective, your program should take as few steps as possible to achieve the final result. In other words, it should go as fast as possible.

en	star 3:

en	code length secondary objective

en	To achieve this objective, your program should be as few lines as possible (line numbers are displayed to the left of the heroes' instructions).

en	code example:

en	example:

en	%%statement branching-statement$if%% allows to run instructions only if a given condition is true.

en	You could read the above example as "If the square to the right of me is a wall, then go to the left. Otherwise go to the right".

en	%%statement branching-statement$if%% checks if the condition is true in which case it will run the instructions inside it (instructions to the right of the vertical gray line). Otherwise it will run the instructions inside the %%statement branching-statement$else%% if there is one.

en	%%statement branching-statement$else%% is not initially part of the %%statement branching-statement$if%%. To make it appear, drag any instruction over the %%statement branching-statement$if%%. If you remove all the instructions inside %%statement branching-statement$else%%, it will disappear.

en	Click on the plus sign to add other conditions.

en	You could read the above example as "If the square to the right of me is a wall or if the square to the right of me is a hole, then go to the left".

en	%%statement branching-statement$jump%% allows to jump backward or forward in the program.

en	You could read the above example as "Step to the right infinitely many times".

en	The first line creates an "anchor" named "a". The third line says to jump back to this anchor. You can choose any name you want for your anchors. Each jump must match a unique anchor.

en	%%statement branching-statement$jump%% is usually used with %%statement branching-statement$if%% to create loops which stop at a condition.

en	You could read the above example as "Step to the right as long as the square to the right is not a wall".

en	%%statement branching-statement$clone%% creates a clone of the hero next to him.

en	You could read the above example as "Create a clone on your left. Then step to the right". For the created hero, %%statement branching-statement$clone%% acts like %%statement branching-statement$jump%%. In this example, the created clone won't step to the right because he will begin to follow instructions after the arrow of %%statement branching-statement$clone%%.

en	The created clone starts his life with the same variables values as his creator's. %%icon mdi mdi-alert-octagon-outline$%%Warning: if you try to create a clone on a square already occupied (by a %%icon icon-hero$%% hero, a %%icon icon-cauldron$%% cauldron etc.) or on a forbidden square (like a %%icon icon-wall$%% wall), the cloning process will fail. In certain levels, this failure causes the death of the hero trying to clone himself.

en	%%statement action-statement$step%% says to your hero to go in a direction. If you specify multiple directions, the hero will decide randomly between these directions.

en	You could read the above example as "Go one step to the left or to the right".

en	%%statement action-statement$step%% says to your hero to go in a direction.

en	You could read the above example as "Go one step to the right".

en	%%statement action-statement$fireball%% throws a fireball on a square around the hero. If the fireball hits another hero it will kill him. You can use a fireball to light a %%icon icon-bonfire$%% bonfire.

en	You could read the above example as "Throw a fireball to the right".

en	%%statement action-statement$take%% says to your hero to take an item.

en	You could read the above example as "If there is an egg on the square on your right, take this egg".

en	%%statement action-statement$drop%% says to your hero to drop his item.

en	You could read the above example as "Drop your item on the square on your right".

en	%%statement action-statement$write%% says to your hero to write something on his item.

en	You could read the above example as "Write 3 on your item".

en	%%statement assign-statement$set%% initializes a variable.

en	You could read the above example as "Set the variable a to 3".

en	%%statement assign-statement$calc%% makes a calculation and puts the result in a variable.

en	You could read the above example as "Set the variable b to a + 2".

en	In Selfless Heroes, there are only integer numbers. The operator %%type-operator$"/"%% is integer division. For example, %%type-operator$9 / 2 = 4%%. The operator %%type-operator$"%"%% is called "modulo". It calculates the remainder of the integer division. For example, %%type-operator$9 % 2 = 1%% because %%type-operator$9 / 2 = 4%% has a remainder of 1.

en	%%statement assign-statement$nearest%% searches for the nearest object of a given type (%%icon icon-cauldron$%% cauldron, %%icon icon-egg$%%egg etc.) and puts the result in a variable.

en	You could read the above example as "Memorize the nearest egg in the variable a and then go get that egg".

en	%%statement speach-statement$tell%% allows you to say a message to other heroes.

en	You could read the above example as "Tell 'ok' to the hero on the right of you".

en	You can also %%statement speach-statement$tell%% a message to every %%icon icon-hero$%% hero of the level.

en	You could read the above example as "Tell "hey" to everyone".

en	%%statement speach-statement$listen%% tells the hero to wait until he hears a specific message.

en	You could read the above example as "Wait for a hero to tell you "hey" then go right".

en	steps

en	lines

en	secondary objectives can be very difficult and it is often impossible to achieve both with the same solution

en	objective

en	secondary objectives

en	your solution is tested to make sure it works every time

en	your fastest was %%score-number${minStep}%% steps

en	your smallest was %%score-number${minLength}%% lines

en	back

en	improve

en	Run [ctrl+space]

en	Pause [ctrl+space]

en	Step by step [ctrl+enter]

en	Stop [ctrl+backspace]

en	Speed [alt+←] [alt+→]

en	Undo [ctrl+z]

en	Redo [ctrl+y]

en	Delete

en	Switch to graphic editor [ctrl+e]

en	Switch to code editor [ctrl+e]

en	Your code is ready to be run

en	Your instructions are not complete: click me for more details

en	There is an error in your code: click me for more details

en	Your code is ready to be run

en	Your code contains %%undefined$undefined%% keywords. Replace them by correct values before running your code.

en	There is an error in your code. If you switch to graphic editor now, parts of it risk to be erased.

en	line {line}

en	Errors

en	you wrote something erroneous after this {statementType}.

en	you wrote something erroneous after this %%keyword${statementType}%%.

en	%%keyword${statementType}%% is not available in this level.

en	messages are not available in this level.

en	Arithmetic operators are not available in this level.

en	you wrote something erroneous after the function %%function${keyword}()%%.

en	%%keyword${statementType}%% expects a direction (%%literal${allowedDirections}%%) and an anchor.

en	%%variable${variable}%% variable name is not allowed. Use one of the following instead: %%variable${allowedIdentifiers}%%.

en	%%number${value}%% number is either too small or too large: numbers must be between %%number${min}%% and %%number${max}%%.

en	%%string$"{message}"%% message is not allowed. Use one of the following instead: %%string${allowedMessages}%%.

en	%%function${code}%% is not a valid function. Use one of the following instead: %%function${allowedFunctions}%%.

en	%%function${code}%% is not a valid action. Use one of the following instead: %%function${allowedFunctions}%%.

en	%%function${keyword}()%% is not available in this level. Use one of the following instead: %%function${allowedFunctions}%%

en	%%function${keyword}()%% is not available in this level. Use one of the following instead: %%function${allowedFunctions}%%

en	Directions are not available in this level.

en	%%literal$everyone%% is not available in this level.

en	Numbers are not available in this level.

en	%%literal$myitem%% is not available in this level.

en	Object types are not available in this level.

en	Terrain types are not available in this level.

en	%%function${keyword}()%% requires exactly one parameter which can be a number, a variable, a direction or %%literal$myitem%%

en	%%variable${param}%% is not a valid number, variable, direction or %%literal$myitem%%

en	%%variable${param}%% is not a valid variable or direction. You can use these instead: %%variable${allowedVariables}%% %%literal${allowedDirections}%%

en	%%function${keyword}()%% requires exactly one parameter which can be a number or a variable (%%variable${allowedVariables}%%)

en	%%function${keyword}()%% requires exactly one number parameter

en	%%variable${param}%% is not a valid number

en	%%variable${param}%% is not a valid number or variable

en	%%function${keyword}()%% requires exactly one direction parameter: %%literal${directions}%%

en	%%function${keyword}()%% requires one direction (%%literal${allowedDirections}%%) or a variable (%%variable${allowedVariables}%%)

en	%%function${keyword}()%% requires one or more direction parameters (%%literal${allowedDirections}%%) or a variable (%%variable${allowedVariables}%%)

en	%%function${keyword}()%% requires exactly one object type parameter: %%literal${allowedValues}%%

en	%%variable${param}%% is not a valid direction. Use one of these instead: %%literal${allowedValues}%%

en	%%variable${param}%% is not a valid object type. Use one of these instead: %%literal${allowedValues}%%

en	%%function${keyword}()%% does not accept direction %%literal${param}%%. Use one of these instead: %%literal${allowedValues}%%

en	%%keyword${keyword}%% does not accept direction %%literal${param}%%. Use one of these instead: %%literal${allowedValues}%%

en	%%function${keyword}()%% does not accept object type %%literal${param}%%. Use one of these instead: %%literal${allowedValues}%%

en	%%function${keyword}()%% takes 3 parameters. Params 1 and 3 must be either numbers, directions, %%literal$myitem%% or variables and param 2 must be an operator (%%operator${operators}%%)

en	%%function${keyword}()%% takes 2 parameters. Param 1 must be a message (%%string${allowedMessages}%%) and param 2 must be either a direction (%%literal${allowedDirections}%%) or %%literal$everyone%%

en	you cannot pass %%literal${param}%% parameter twice to %%function${keyword}()%%

en	when you give several parameters to the %%function${keyword}()%% function, they must be of the same type

en	%%literal${keyword}%% object type is not available in this level. You can use one of the following: %%literal${allowedValues}%%

en	%%literal${keyword}%% terrain type is not available in this level. You can use one of the following: %%literal${allowedValues}%%

en	a condition must contain a valid comparator like these: %%operator${allowedOperators}%%

en	%%variable${code}%% is not a valid keyword

en	%%variable${code}%% is not a valid instruction

en	%%variable${variable}%% variable is unavailable in this level. Use one of the following: %%variable${allowedNames}%%

en	variables are not available in this level

en	%%keyword${keyword}%% condition must be closed with a %%code$:%%

en	%%keyword${elseKeyword}%% without %%keyword${ifKeyword}%% before

en	%%keyword${endifKeyword}%% without %%keyword${ifKeyword}%% before

en	%%keyword${ifKeyword}%% without %%keyword${endifKeyword}%%

en	%%bracket${anchorName}:%% found twice. Anchors must have unique names

en	%%keyword${jumpKeyword}%% to unknown anchor %%bracket${anchorName}:%%

en	anchor

en	assignment

en	direction

en	if

en	else

en	jump

en	clone

en	step

en	fireball

en	take

en	drop

en	write

en	tell

en	to

en	listen

en	set

en	calc

en	nearest

en	and

en	or

en	delete

en	direction

en	number

en	my item

en	everyone

en	"hey"

en	"lol"

en	"ho"

en	"kiss"

en	"stop"

en	"wait"

en	"ok"

en	"coffee"

en	nothing

en	hero

en	beast

en	switch

en	bonfire

en	cauldron

en	spikes

en	egg

en	wall

en	floor

en	hole

en	infected

en	nothing

en	Some of the tests failed. We reproduced the same situation as in these failed attempts.

en	Your program takes too much time

en	Your heroes fell asleep before completing the objective

en	All your heroes are dead

en	One of your heroes is dead

en	This file is not a valid .shlv file: