' ' Solves Attemptation No. 1 The Age newspaper ' ' Puzzle by Albert Haddad - www.theage.com.au ' ' P L E A S E ' S O L V E ' + P U Z Z L E ' ----------- ' = * * * * * * ' ----------- ' ' Where Z = 7, * = 7, others 0, 1, 2, 3, 5, 6, 8, 9 ' ' Partial solution required, since E = 9, P = 3 (it is ' easy to solve for these values) ... others are more ' difficult! Solve only for A, L, O, S, U, V ' this provides a faster solution! ' ' QBASIC written by: P.King - www.procontechnology.com.au ' ' Process - random selection of values until solution found ' DIM b(6) DIM c(6) CLS 'RANDOMIZE TIMER DO c(1) = 0 c(2) = 1 c(3) = 2 c(4) = 5 c(5) = 6 c(6) = 8 FOR n0 = 6 TO 1 STEP -1 i0 = INT(RND * n0 + 1) b(n0) = c(i0) c(i0) = c(n0) NEXT n0 P = 3 '! L = b(1) E = 9 '! A = b(2) S = b(3) O = b(4) V = b(5) U = b(6) Z = 7 'given! t1 = t1 + 1 PRINT t1; L; A; S; O; V; U; n1 = ((((P * 10 + L) * 10 + E) * 10 + A) * 10 + S) * 10 + E n2 = (((S * 10 + O) * 10 + L) * 10 + V) * 10 + E n3 = ((((P * 10 + U) * 10 + Z) * 10 + Z) * 10 + L) * 10 + E r1 = n1 + n2 + n3 PRINT r1 IF r1 = 777777 THEN PRINT PRINT PRINT "P L E A S E "; P; L; E; A; S; E PRINT PRINT " S O L V E "; S; O; L; V; E PRINT PRINT "P U Z Z L E "; P; U; Z; Z; L; E PRINT END END IF LOOP UNTIL INKEY$ <> ""