1 / 9
Apr 2006

Please admins, would you provide the X & . version of the picture examples, so we could check our progs?

  • created

    Apr '06
  • last reply

    Sep '18
  • 8

    replies

  • 2.1k

    views

  • 6

    users

  • 4

    links

Actually, I planned that it would be the part of problem, to do this convertor. But I can put here the TCL-code with which I convert BMP's to 'X'-'.'. I'll do it today's evening.

Convertor from BMP to TXT written in TCL\TK language (freeware and can be found here: tcl.tk4). First argument input BMP file second argument output TXT file.

#!/bin/sh
# The next line restarts using wish8.3 \
exec wish8.3 $0 ${1+"$@"}
package require Img
proc Convert {inpFile outFile} {
	set filename $inpFile
	set outfile $outFile
    if {[string compare $filename {}]} {
    set imagename [list $filename]
    image create photo $imagename -file $filename
	set ff [open $outfile "a"]
	puts $ff "[image height $imagename] [image width $imagename]"
	for {set i 0} {$i < [image height $imagename]} {incr i 1} {
		set s ""
		for {set j 0} {$j < [image width $imagename]} {incr j 1} {
			set a [$imagename get $j $i]
			if {$a == "255 255 255"} {
				set a "."
			} else {
				set a "X"
			}
			set s "$s$a"
		}
		puts $ff $s
	}
	close $ff
}
}
Convert [lindex $argv 0] [lindex $argv 1]
2 years later

Hi!

Someone can give me some reference (book,pdf,site) for help me the solve that problem type?

thanks and even more!smile

2 years later

Mając w pamięci bajkę Fredry ,,Trzeba by3'' oraz ponawiane w poprzednich postach deklaracje, że trzeba by dodać link do tego wątku postanowiłem sam to zrobić. Mam nadzieję że katalizatorzy rozwiązania, czyli aver (twórca wątku) i narbej (dawca algorytmu wink) mi to wybaczą.

4 years later

IMHO
Nie powinniśmy trzymać na spoju zadania, którego zaliczenie wymaga zaimplementowania błędnego algorytmu.
Chyba, żeby testy mocno powiększyć i przerobić zadanie na challange?

3 years later