Allegiance(2)!

Discussion in 'Computer Science & Culture' started by Waiter_2001, Sep 13, 2014.

  1. Waiter_2001 Registered Senior Member

    Messages:
    459
    A computer program/game updated:

    Code:
    DIM ALLEGIANCE$(10,4),ANIMAL$(10,10)
    
    FOR A=1 TO 10
    
    ALLEGIANCE$(A,3)=STR$(A)
    
    ALLEGIANCE(A,4)=STR$(10)
    
    NEXT A
    
    10
    
    CLS
    
    14
    
    INPUT "PLAYER(1-10):",PLAYER
    
    IF (ALLEGIANCE$(PLAYER,4)=STR$(0)) THEN
    
    PRINT ANIMAL$(PLAYER,VAL(ALLEGIANCE$(PLAYER,2)))
    
    ALLEGIANCE$(PLAYER,2)=STR$(VAL(ALLEGIANCE$(PLAYER,2))+1)
    
    IF (ALLEGIANCE$(PLAYER,2)=STR$(11)) THEN ALLEGIANCE$(PLAYER,2)=STR$(1)
    
    GOTO 14
    
    END IF
    
    FOR A=1 TO 10
    
    IF (ALLEGIANCE$(PLAYER,2)=ALLEGIANCE$(A,2)) THEN
    
    IF (ALLEGIANCE$(PLAYER,3)=ALLEGIANCE$(A,3)) THEN
    
    PRINT A;".";ALLEGIANCE$(A,1)
    
    PRINT "TIME:";ALLEGIANCE$(A,2)
    
    PRINT "SPACE:";ALLEGIANCE$(A,3)
    
    PRINT "HEALTH:";ALLEGIANCE$(A,4)
    
    END IF
    
    END IF
    
    NEXT A
    
    INPUT "ALLEGIANCE:",ALLEGIANCE$(PLAYER,1)
    
    IF (ALLEGIANCE$(PLAYER,1)="END") THEN END
    
    IF (ALLEGIANCE$(PLAYER,1)="SPACE" THEN ALLEGIANCE$(PLAYER,3)=STR$(VAL(ALLEGIANCE$(PLAYER,3))+1)
    
    IF (ALLEGIANCE$(PLAYER,1)="HEALTH") THEN ALLEGIANCE$(PLAYER,4)=STR$(VAL(ALLEGIANCE$(PLAYER,4))+2)
    
    ANIMAL$(PLAYER,VAL(ALLEGIANCE$(PLAYER,2)))=ALLEGIANCE$(PLAYER,1)
    
    ALLEGIANCE$(PLAYER,2)=STR$(VAL(ALLEGIANCE$(PLAYER,2))+1)
    
    ALLEGIANCE$(PLAYER,4)=STR$(CAL(ALLEGIANCE$(PLAYER,4))-1)
    
    IF (ALLEGIANCE$(PLAYER,2)=STR$(11) THEN ALLEGIANCE$(PLAYER,2)=STR$(1)
    
    GOTO 10
    
    
    The above code is for ten players but this can be altered (I suppose I should have added a line allowing the user to enter the number of players.)

    The profile for each player is:

    1.ALLEGIANCE
    2.TIME
    3.SPACE
    4.HEALTH

    One is added to time each turn until the number of players is reached, at which point the counter returns to one.

    Space is default to the player's number unless "SPACE" is typed as your allegiance and then one is added to space (again until the number of players is reached and then it returns to one.)

    Each turn one is taken from your health unless "HEALTH" is typed as your allegiance, and then two is added to your health: it would be one but then it is impossible to gain any more health because the one added is taken by your turn. It should be noted that it is possible to gain infinite health with the above program but this can be changed simply by adding a line of code yourself.

    Should the players health reach zero then they become an animal: the last ten turns are recorded by the variable ANIMAL$, and are returned should you try to use the player.

    If time and space are equal for any of the players then you may see each others' profiles.

    Enjoy!

    Please Register or Log in to view the hidden image!

     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Waiter_2001 Registered Senior Member

    Messages:
    459
    ...similar to the above program was one written in excel: it has objects containing variables which when acted upon effect the user's profile, e.g. one may have an object named COINS which act like a poison;

    1.(NAME)COINS
    2.(HEALTH)-10

    The coding is simply 2.+2. Should 2.(health) be a negative digit then the players' health will be subtracted.

    Please Register or Log in to view the hidden image!

     
  4. Google AdSense Guest Advertisement



    to hide all adverts.

Share This Page