Developer's Diary
Software development, with Terry Ebdon
22-Feb-2019 Trk21 Scan error & weapons fire

Short range scan error in Trk21

An odd Using key … appears every time a short-range scan is performed:

Using key: [8, 4]
---------------
. . . . . . . .
. . . . . . . .
. . . . . . . *
. . . . . . . .
. . . . . . . .
* . . . . . . .
. * . . . . . .
. E . . . . . .
---------------
STARDATE: 3600 CONDITION: YELLOW
QUADRANT: 4 - 8 SECTOR: 2 - 8
ENERGY: 3000 PHOTON TORPEDOS: 10
KLINGONS: 23

Logged as issue #2.

This is a simple fix, a debugging statement left at line 38 in Galaxy.groovy needed to be removed.

33  final int getAt( final Coords2d keyCoords) {
34  assert size()
35  assert keyCoords != null && board != null && keyCoords.isValid()
36  final ArrayList key = [ keyCoords.first(), keyCoords.last() ]
37  // println board.keySet()
38  println "Using key: $key"
39  board.get key
40  }

Weapons fire

It's not much of a war game if you can't shoot the enemy.

Enhancement: Phaser fire

Logged as enhancement issue #3.

Firing a phaser should:

  1. Reduce the target's available energy by the hit amount.
  2. Remove the target from the game if it's energy <= 0.
  3. Inform the user of the weapon's effectiveness.
  4. Tell the user they've won the game when the last target is destroyed.

Note: Some of these items may be deferred until torpedo firing is implemented, or moved into their own enhancement.

Enhancement: Torpedo fire

Logged as enhancement issue #4.

Firing a torpedo should:

  1. Display a track until either:
    • it hits the target, or
    • it leaves the sector.
  2. Remove the target from the game if the torpedo hits it, where a target can be any game object, i.e.
    • An enemy ship.
    • A star base.
    • A star.
  3. Tell the user they've won the game when the last target is destroyed.

Note: Some of these items may be implemented as part of issue #3.

19-FEB-2019 👈 Top of page 👉 23-FEB-2019

© 2020 Terry Ebdon.

Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.