Rogue-like ascii based on Arduboy


Be careful by that bit.

(Stephane C) #82

Did you test if throwing shuriken or arrows really does damage. To me it always seem to do nothing…

(Pharap) #83


Replying in Japanese is harder than improving the code.
I am very experienced with C++, but I am not very experienced with Japanese.

Sometimes starting again is best.
Planning the program is just as important as writing it.

(I’m not sure if that should be 「が」or 「を」.)

Don’t use + for combining bits. Use | instead.

A_BUTTON = 0b00001000 (0x08, 8)
DOWN_BUTTON = 0b00010000 (0x10, 16)

A_BUTTON + DOWN_BUTTON = 0b00011000 (0x18, 24)
A_BUTTON | DOWN_BUTTON = 0b00011000 (0x18, 24)

A_BUTTON + DOWN_BUTTON + DOWN_BUTTON = 0b00100000 (0x20, 32)
A_BUTTON | DOWN_BUTTON | DOWN_BUTTON = 0b00011000 (0x18, 24)

What is the button combination for?

This should have a similar effect:

if (arduboy.pressed(A_BUTTON) && arduboy.justPressed(DOWN_BUTTON))


if (arduboy.justPressed(DOWN_BUTTON) && (arduboy.buttonsState() == (A_BUTTON | DOWN_BUTTON))


(Stephane C) #84

That was to bring up the status screen. Before that pressing A to search/rest was bringing the status screen everytime, the reason why I suggested a combo was to fix that issue.

(Stephane C) #85

Rogue on the go!

Didn’t get far though…


To @Vampirics.

I have a great test player. I grasped the problem. I can solve this problem in the next release.

I have a request. Can I adopt the display method of the status screen you thought in the next release? I feel this way is more natural.

(Stephane C) #87

It’s your game, you do what you prefer.

(Pharap) #88

While I think of it…
@BlueMax, have you learnt about enum class yet?
I think enum class would help with monsters and items.

(Also, are you wondering why I wrote “learnt” instead of “learned”?)

(Sorry for not trying to write in Japanese this time, it’s 23:20 here so I don’t have the time to figure it out.)


When are you sleeping? Perhaps you can live without sleeping?

To @Pharap.

FORTRAN in college may be the last time I learned programming. You can guess my age. My current work has nothing to do with programming at all. Coincidentally I got Arduino and resumed programming for the first time. I am, really, an old programmer. I can understand the explanation of ”enum"=“列挙子”, but I can not use it.

I do not understand. I’m sorry. why?

(Pharap) #90

I could try…(冗談です。)


Many people here are fairly old. See this topic.


At first I didn’t understand what this meant,
but I looked at and now I know it means “enumerator”.


enum class MonsterType : uint8_t
	None = 0,
	IceMonster = 5,
	Snake = 6,
	Leprechaun = 9,
	Aquator = 12,

void specialAttack(MonsterType monsterType)
		case MonsterType::IceMonster:
			// Ice Monster Attack
		case MonsterType::Snake:
			// Snake Attack
		case MonsterType::Leprechaun:
			// Leprechaun Attack
		case MonsterType::Aquator:
			// Aquator Attack


(This should be “enumerators have a ‘name’ and a ‘value’”, but I couldn’t figure out how to say “have”.)


// ⭘
MonsterType typeA = MonsterType::IceMonster;
// ☓ コンパイラーエラー 
MonsterType typeB = 5;


MonsterType monsterType = MonsterType::IceMonster;
// ⭘
if(monsterType == MonsterType::IceMonster)
	arduboy.print(F("Ice Monster"));
// ⭘
if(monsterType != MonsterType::Aquator)
	arduboy.print(F("Not an aquator"));
// ☓ コンパイラーエラー
if(monsterType == 5)
	arduboy.print(F("Ice Monster"));


// ⭘
if(static_cast<uint8_t>(monsterType) == 5)
	arduboy.print(F("Ice Monster"));

Hopefully that made sense?
‘Scoped enumerations’ (スコープなし列挙) are just ‘values’ (値) with ‘names’ (名).
They are ‘type-safe’ (型安全性), and have meaningful names.
This is good because ‘magic numbers’ (マジックナンバー) are evil.

Do you mean “Why did you write it?” or “Why would I wonder why?”?


he probably meant that your usage of “learnt” instead of “learned”

Woot. Even I would’ve turned off my computer at 23:00 (no later than that)


It’s 1:49 A.M. in Britain right?
He probably slept at this point…

It basically declare a type of variable (Monstertype) with a pre-defined type (such as int16_t or int8_t)
And then what it does is stores the “names” of the monsters – “leprechaun”, “ice monster” – and store it as a int8_t or int16_t

You can also define the values manually, as Pharap did.


struct monsters {
    int16_t Xcoord;
    int16_t Ycoord;
    uint8_t life;
    uint8_t type;

//initialize a monster called Icemonster
monsters Icemonster;

//assigning and getting values
Icemonster.Xcoord = 24;
Icemonster.type = IceMonster;//from the enum class of Monster type

This way you don’t need to work with “meaningless numbers” or “magical numbers” as Pharap said.


Hello, everyone.
Now I release new version of my “Rogue” game!

This version uses “remove USB stack” technique. When you upload a new game, you need to hold down the DOWN button while ARDUBOY is starting up.

Rogue10.hex.pdf (77.5 KB)

Since I could almost put in the features I was planning to implement, I will make this release version 1.0.

This version is:

  • [FIX] Though a hero is levitating, things can be picked up.
  • [FIX] Message when reading scroll of identify
  • [FIX] Effect of potion of power (thanks for @Pharap)
  • [FIX] Slower monster with wand of slow
  • [FIX] Damage effect of thrown weapons(thanks for @Vampirics)
  • [FIX] Leprechaun steals money though hero does not have money
  • [FIX] A transparent enemy will see it when it attacks
  • [FIX] Food is always yummy
  • [SYS] Low hunger and hit point notification by red LED.
  • [SYS] A_BUTTON, rest and search only. Open the status screen with the A_BUTTON and DOWN_BUTTON.(thanks for @Vampirics)
  • [SYS] When the hero collapses, the tombstone is displayed.
  • [SYS] A message to the winner(like original “Rogue 5.4.4”)
  • [SYS] High score is recorded on EEPROM.(thanks for @Vampirics)

I will put the source program on GitHub.However, since I have written this program all the time, I do not understand how to use GitHub. From now on, I will challenge how to use.


To @Pharap.

I used the structure for the first time in this release.

struct score {
long int gold;
byte depth;
score glory[5];

And this structure is saved in EEPROM. It’s only this, it’s a big growth for me.

I mean “Why did you write it?”. I really am not good at reading and writing English. Since I was a student, I had a hard time with “English”.

To @CDR_Xavier.

I feel that I understood somehow. However, I do not really understand English well. Thank you for giving an explanation.

(Pharap) #94

Pre-defined underlying type. The distinction is important.
The enumeration type has the size and binary representation of the underlying type,
but the compiler considers it to be a distinct type,
which is important for the type safety mechanism.

It doesn’t store the name, it associates the name with a value.
(Again, an important technical distinction.)
Every ‘enumerator’ is a named constant value.

That wouldn’t work for an enum class, you’re getting enum (unscoped enumerations) and enum class (scoped enumerations) confused.

You can’t just write IceMonster, you have to write MonsterType::IceMonster - that’s what the ‘scoped’ part of ‘scoped enumeration’ means.

Also your choice of naming is a bit off, you’d want something more like this:

struct Monster
    int16_t x;
    int16_t y;
	// or 'health' or 'hp'
    uint8_t healthPoints;
    MonsterType type;

// Assign everything at once
// This is an example of C++11's 'uniform initialisation syntax'
Monster monster { 24, 32, 100, MonsterType::IceMonster };

But not necessarily that exact code.

Yep. My last comment was at 01:24.
(I would have gone after my previous comment at 23:17,
but I started falling asleep in the chair at around midnight.)


It takes some time to get used to, but it is worth the effort.
If you need to know how to do something, just ask.

The most important things you need to know are:

  • How to upload code (コードをアップロードする)
  • What a ‘pull request’ (プルリクエスト) is
    • Also called a ‘PR’ (ピーアー) for short
  • How to manage ‘releases’ (リリース?)



Ah, ok. This is why I mentioned it - I thought you might not know.

In English, most past tense (過去形|過去時制) verbs (動詞) end in ‘-ed’ or ‘-t’.
(E.g. ‘to dream’ (夢を見る|夢見る) -> ‘dreamed’/‘dreamt’ (夢を見ました|夢を見た))
Using ‘-ed’ is more common in America (アメリカ|米国).
But ‘-t’ is more common in Britain (イギリス|英国) (and some other ‘commonwealth countries’ (イギリス連邦) like Australia (オーストラリア)).


They didn’t teach us Japanese at school.
I have learnt it in my spare time.

I did have a teacher once though…
(リーダー? 指導者? 領袖? 班長?)

(I’m still useless with 「は」vs 「が」…)


To @Pharap.

I see. I will challenge!

I knew that I was learning ”Beigo"=”米語”, not ”Eigo"="英語”…

I think that you know:
America “亜利加” in Chinese character.
Britain “吉利” in Chinese character.

(Pharap) #96

They’re in English, but these might help:

画像をクリックしたら → 画像を伸​ば​し​ま​す
(If you click on the images the images will grow.)

(I couldn’t figure out how to turn “伸びる” into future tense, or how to write “if” and “then” in Japanese. Hopefully what I wrote makes sense.)

If you can’t read the articles,
maybe some of the other Japanese users can help?


“Rice language” と “Hero language”… 面白いです。


でも、“Usually written using kana alone”。


I often forget that ”kanji" actually means “Chinese character”.


Must bow down in front of this guy …
I had thought of asking you, but you were probably in your soft bed already, so I just typed stuff…

My bad.

(Pharap) #98

Indeed I was.

I would have worked with an unscoped enumeration (plain enum),
but not with a scoped enumeration (enum class).
Scoped enumerations are better because they’re more typesafe.


Hello everyone.

There was a little room in the memory, so I added two features to the game.I will publish it as version 1.1.

Rogue11.hex.pdf (78.2 KB)

This version uses “remove USB stack” technique. When you upload a new game, you need to hold down the DOWN button while ARDUBOY is starting up.

This version is:

  • [FIX] When the game is over, turn off the red LED(thanks for @Vampirics)
  • [FIX] Monsters flee after stealing things
  • [FIX] Big Room appears below the 5th floor

I am thinking about game balance right now. I would be happy if I got opinions.

To @Pharap.
Really sorry. I will fix my program as long as I have time. I do not even have time to read GitHub’s explanation. Please let me put this release here as well. (23.1 KB)

It is a dirty code, which is the same as ever…:sleeping:

(Simon) #100

Is that your kid drowning in lane 3?