1. conversion

Hey folks, I am very new to programing, and was wondering if it was
possible to write a program that would convert 1's and 0's to letters,
words, and vice versa. Any help would be greatly appreciated.

new topic     » topic index » view message » categorize

2. conversion

klepto (nice name smile  wrote:
> Hey folks, I am very new to programing, and was wondering if it was
> possible to write a program that would convert 1's and 0's to letters,
> words, and vice versa. Any help would be greatly appreciated.

  I would probably be able to do this, but I was wondering exactly what y=
ou
mean by 1's and 0's.  Are you saying that if you passed a 1 to a function=
,
it would return a certain letter, or something more along the lines of
binary code, which is where every letter, number, and symbol has a
different arrangement of 0's and 1's (such as 11100101; there is 8 elemen=
ts
to every binary number).  That sounds like what you are trying to do.  Gi=
ve
us a little more information, and we may be able to help you.
 =

Regards,
  Bryan Watts

new topic     » goto parent     » topic index » view message » categorize

3. Re: conversion

At 04:00 PM 8/1/97 -0400, you wrote:
>---------------------- Information from the mail header
-----------------------
>Sender:       Euphoria Programming for MS-DOS
<EUPHORIA at MIAMIU.ACS.MUOHIO.EDU>
>Poster:       Bryan Watts <BWatts1 at COMPUSERVE.COM>
>Subject:      conversion
>---------------------------------------------------------------------------
----
>  I would probably be able to do this, but I was wondering exactly what y=
>ou
>mean by 1's and 0's.  Are you saying that if you passed a 1 to a function=
>,
>it would return a certain letter, or something more along the lines of
>binary code, which is where every letter, number, and symbol has a
>different arrangement of 0's and 1's (such as 11100101; there is 8 elemen=
>ts
>to every binary number).  That sounds like what you are trying to do.  Gi=
>ve
>us a little more information, and we may be able to help you.
> =
>
>Regards,
>  Bryan Watts
>
Yes, binary code. What I was thinking, was inputing a sequence of binary
codes and having the app convert it to text, and also the other way around,
input text, and have the app convert it to binary.
Thanks :)

new topic     » goto parent     » topic index » view message » categorize

4. Re: conversion

klepto wrote:
> Yes, binary code. What I was thinking, was inputing a sequence of binary
> codes and having the app convert it to text, and also the other way around,
> input text, and have the app convert it to binary.
> Thanks :)

Here's two functions that do this:

---- code begins ----
include machine.e

function text_to_binary(sequence text)
    sequence binary
    binary = {}
    for i = 1 to length(text) do
        binary = binary & int_to_bits(text[i], 8)
    end for
    return binary
end function

function binary_to_text(sequence binary)
    sequence text
    text = {}
    for i = 1 to length(binary) by 8 do
        text = text & bits_to_int(binary[i..i+7])
    end for
    return text
end function

---- code ends ----

--
                   _____         _____         _____
    ________      /\    \       /\    \       /\    \
   /   \    \    /  \____\     /  \____\     /  \____\
  /  _  \____\  /   / ___/_   /   /____/    /   / ___/_
 /  / \  |____|/   / /\____\ /    \    \   /   / /\____\
 \  \_/ /    / \   \/ / ___/_\     \    \  \   \/ / ___/_
  \    /____/   \    / /\    \\/\   \    \  \    / /\    \
   \   \    \    \   \/  \____\  \   \    \  \   \/  \____\
    \   \    \    \      /    /   \   \____\  \      /    /
     \   \____\    \    /    /     \  /    /   \    /    /
      \  /    /     \  /    /       \/____/     \  /    /
       \/____/       \/____/                     \/____/

new topic     » goto parent     » topic index » view message » categorize

5. conversion

I recently came across this program:

 Description : FirePrint! - Custom text print subroutine for  VGA Mode 13
 Written by  : Andrew L. Ayers/Martin Lindhe

 This little routine allows you to place a "burning" text string on the
mode 13 screen written in Qbasic. I liked it so much that I tried to
convert it to Euphoria without much success and was wondering if someone
out there could translate it for me?
 Also , I was wondering if there is a program to convert qbasic programs
to Euphoria?
Any and all help will be much aprieciated.

---------------------------------------------cut-here---------------------------
---------------------------------

DECLARE SUB FirePrint (h%, v%, a$, tilt%)
'
SCREEN 13
'
' Set up an all "red" palette
'
FOR t = 0 TO 63: PALETTE t, t: NEXT t
'
' Call the routine once for a simple "flame" effect,
' or over and over (as done here) for a great "burning"
' effect! Use uppercase for best effect.
'
DO
  CALL FirePrint(18, 12, "WARRIOR", 0)
LOOP UNTIL INKEY$ <> ""

SUB FirePrint (h%, v%, a$, tilt%)
  '
  ' Print the string in bright "red"
  '
  COLOR 63: LOCATE v%, h%: PRINT a$
  '
  ' Set up start and end locations for the burn
  '
  sx% = (h% * 8) - 8: ex% = ((h% + LEN(a$)) * 8) - 8
  sy% = (v% * 8) - 16: ey% = (v% * 8) - 8
  '
  FOR y% = sy% TO ey%
    FOR x% = sx% TO ex%
      '
      ' Take the current color, subtract a random amount for
      ' red flame "fade", and plot the new point
      '
      col% = POINT(x%, y%) - RND * 25: IF col% < 0 THEN col% = 0
      '
      PSET (x% + tilt%, y% - 1), col%
      '
    NEXT x%
  NEXT y%
  '
END SUB

------------------------------------------------cut-here------------------------
---------------------------------

Late
Warrior

new topic     » goto parent     » topic index » view message » categorize

6. Re: conversion

> convert it to Euphoria without much success and was wondering if someone
> out there could translate it for me?

i'll do my best :>...  i'm sure there are mistakes in here coz i
haven't tried this out but it'll give you an idea :>

>  Also , I was wondering if there is a program to convert qbasic programs
> to Euphoria?

nope

-- start program
include graphics.e

integer i

procedure fireprint(atom h,atom v,sequence a,atom tilt)
   atom sx,ex,sy,ey,col

   text_color(63) -- this might be a function, not a procedure ?
   position(v,h)
   printf(1,"%s",{a})

-- Set up start and end locations for the burn

   sx = (h * 8) - 8
   ex = ((h + length(a)) * 8) - 8
   sy = (v * 8) - 16
   ey = (v * 8) - 8

   for y = sy to ey
      for x = sx to ex
-- Take the current color, subtract a random amount for
-- red flame "fade", and plot the new point
         col = get_pixel({x,y}) - rand(25)
         if col < 0 then
             col = 0
         end if
         pixel(col,{x + tilt,y - 1})
      end for
   end for
end procedure

i = graphics_mode(19)

-- set up 'all red palette'
for t = 0 to 63
   i = set_palette(t,t)
end for

while get_key() = ""
   fireprint(18,12,"WARRIOR",0)
end while

 ..ooO  <basehead> claim my goat, thats a Ooo..
.oO  masturbation synonym i havent heard yet Oo.
 ...oooO        MikPos of MARTYR        Oooo...
..ooO  http://www.geocities.com/SoHo/9036  Ooo..
   ....oooO       mike burrell      OOooo....

new topic     » goto parent     » topic index » view message » categorize

7. Re: conversion

--=====================_850458464==_

At 14:56 12-12-96 +0000, you wrote:
>---------------------- Information from the mail header -----------------------
>Sender:       Euphoria Programming for MS-DOS <EUPHORIA at
>MIAMIU.ACS.MUOHIO.EDU>
>Poster:       mike burrell <mikpos at GAIANET.NET>
>Subject:      Re: conversion
>-------------------------------------------------------------------------------
>
>> convert it to Euphoria without much success and was wondering if someone
>> out there could translate it for me?
>
>i'll do my best :>...  i'm sure there are mistakes in here coz i
>haven't tried this out but it'll give you an idea :>
>
>>  Also , I was wondering if there is a program to convert qbasic programs
>> to Euphoria?
>
>nope
>
>-- start program
>include graphics.e
>
>integer i
>
>procedure fireprint(atom h,atom v,sequence a,atom tilt)
>   atom sx,ex,sy,ey,col
>
>   text_color(63) -- this might be a function, not a procedure ?
>   position(v,h)
>   printf(1,"%s",{a})
>
>-- Set up start and end locations for the burn
>
>   sx = (h * 8) - 8
>   ex = ((h + length(a)) * 8) - 8
>   sy = (v * 8) - 16
>   ey = (v * 8) - 8
>
>   for y = sy to ey
>      for x = sx to ex
>-- Take the current color, subtract a random amount for
>-- red flame "fade", and plot the new point
>         col = get_pixel({x,y}) - rand(25)
>         if col < 0 then
>             col = 0
>         end if
>         pixel(col,{x + tilt,y - 1})
>      end for
>   end for
>end procedure
>
>i = graphics_mode(19)
>
>-- set up 'all red palette'
>for t = 0 to 63
>   i = set_palette(t,t)
>end for
>
>while get_key() = ""
>   fireprint(18,12,"WARRIOR",0)
>end while
>
> ..ooO  <basehead> claim my goat, thats a Ooo..
>.oO  masturbation synonym i havent heard yet Oo.
> ...oooO        MikPos of MARTYR        Oooo...
>..ooO  http://www.geocities.com/SoHo/9036  Ooo..
>   ....oooO       mike burrell      OOooo....
>

There is some errors in the previous code.

cute effect!


--=====================_850458464==_

-- start program
include graphics.e

integer i

procedure fireprint(atom h,atom v,sequence a,atom tilt)
   atom sx,ex,sy,ey,col

   text_color(63)
   position(v,h)
   printf(1,"%s",{a})

-- Set up start and end locations for the burn

   sx = (h * 8) - 8
   ex = ((h + length(a)) * 8) - 8
   sy = (v * 8) - 16
   ey = (v * 8) - 8

   for y = sy to ey do
      for x = sx to ex do
-- Take the current color, subtract a random amount for
-- red flame "fade", and plot the new point
         col = get_pixel({x,y}) - rand(25)
         if col < 0 then
             col = 0
         end if
         pixel(col,{x + tilt,y - 1})
      end for
   end for
end procedure

i = graphics_mode(19)

sequence p
-- set up 'all red palette'
for t = 0 to 63 do
   p = palette(t,{t,0,0})
end for

while get_key() = -1 do
   fireprint(18,12,"WARRIOR",0)
end while

i = graphics_mode(-1)

--=====================_850458464==_

Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at quebectel.com

--=====================_850458464==_--

new topic     » goto parent     » topic index » view message » categorize

8. Re: conversion

Thank's to everyone for your help converting fireprn.bas maybe I can
return the favor someday.

Late
Warrior

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu