Main      Site Guide    
Message Forum
Re: AGLL challenge
Posted By: Mensekemeser, on host 209.226.188.6
Date: Wednesday, December 5, 2001, at 14:08:02
In Reply To: AGLL challenge posted by gremlinn on Wednesday, December 5, 2001, at 13:55:08:

> Suppose that two variables (v1 and v2) each store a number between 0 and 9999 (inclusive). All other variables are assumed initialized to zero. Write a sequence of AGLL commands for which the final value of v1 is the original value of (v1 + v2).

Simple method.

c v2>8191
.....v 2 - 8192
.....v 1 + 8192
c v2>4095
.....v 2 - 4096
.....v 1 + 4096
c v2>2047
.....v 2 - 2048
.....v 1 + 2048
c v2>1023
.....v 2 - 1024
.....v 1 + 1024
c v2>511
.....v 2 - 512
.....v 1 + 512
c v2>255
.....v 2 - 256
.....v 1 + 256
c v2>127
.....v 2 - 128
.....v 1 + 128
c v2>63
.....v 2 - 64
.....v 1 + 64
c v2>31
.....v 2 - 32
.....v 1 + 32
c v2>15
.....v 2 - 16
.....v 1 + 16
c v2>7
.....v 2 - 8
.....v 1 + 8
c v2>3
.....v 2 - 4
.....v 1 + 4
c v2>1
.....v 2 - 2
.....v 1 + 2
c v2=1
.....v 1 + 1

41 lines. Hopefully I didn't make any syntax errors or anything.

Replies To This Message

Post a Reply

RinkChat Username:
Password:
Email: (optional)
Subject:
Message:
Link URL: (optional)
Link Title: (optional)

Make sure you read our message forum policy before posting.