Question
Conway's Problem: Write a program to read 80-column cards and write them as 125-character lines with the following changes. After every card image the string
Conway's Problem: Write a program to read 80-column cards and write them as 125-character lines with the following changes. After every card image the string is inserted. Every adjacent pair of asterisks ** is replaced by a #. The problem has an elegant solution with three concurrent processes. One process producer reads cards and inserts the string when necessary and passes characters through a one-character buffer to a process squash. squash, which knows nothing about 80-column cards, simply looks for double asterisks and passes a stream of modified characters to a process print. print takes the characters and prints them as 125-character lines. Write a program to solve Conway's problem with three separate processes for the producer, squasher and printer as described above using three concurrent processes with the following modifications: - Your program should read in the card text from a file called lab5.txt - Each card is 20 characters long (not 80 column cards). - To simulate card input read from a file where each line has 20 characters. - Printer process: prints 25-character lines to the screen (not 125 character lines).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started