Skip to content

Hills implementation #3

@kuashio

Description

@kuashio

Does the "Hills not implemented yet" comment on the starter packages page mean that the code doesn't register hills in the local map representation?

I made my own implementation and it has worked fine.
I just added a new case into the switch in the _init_map function in ants.c
Here it is:

// Updates the map.
//
//    %   = Walls       (the official spec calls this water,
//                      in either case it's simply space that is occupied)
//    .   = Land        (territory that you can walk on)
//    a   = Your Ant
// [b..z] = Enemy Ants
// [A..Z] = Dead Ants   (disappear after one turn)
//    *   = Food
//    ?   = Unknown     (not used in latest engine version, unknowns are assumed to be land)
//    @   = Enemy Hill
//    +   = Your Hill

...

        switch (*data) {
            case 'w':
                game_info->map[offset] = '%';
                break;
            case 'a':
                game_info->map[offset] = var3 + 49;
                break;
            case 'd':
                game_info->map[offset] = var3 + 27;
                break;
            case 'f':
                game_info->map[offset] = '*';
                break;
            case 'h':                                           // hills, by kuashio
                game_info->map[offset] = (var3=='0')?'+':'@';   //    @   = Enemy Hill
                break;                                          //    +   = Your Hill
        }

Is this enough to say hills are implemented in C?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions