Future Contests: Speed Coding

This is a discussion on Future Contests: Speed Coding within the Contests Board forums, part of the Community Boards category; This was it Your goal is to create a program which analyzes an HTML file and outputs statistics about it. ...

  1. #46
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    This was it
    Your goal is to create a program which analyzes an HTML file and outputs statistics about it.
    Input will be a filename, passed as the first parameter to your program. Eg. htmlanalyze.exe filename.txt Output will be printed to stdout (most likely the screen, unless redirected)
    Output will consist of:
    • File name
    • File size
    • Document name
    • Number of tags
    • Number of times each tag is used
    I took the idea from this board, and dumbed it down a bit to be suitable for this type of contest.
    Edit, I still need 1 more judge to judge these results.

  2. #47
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I can try to help after work tonight if i get in before 9:30, do my best.

  3. #48
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Results:
    Sang-Drax:
    Speed - 5/5
    He completed the program in little over 30 minutes, no one else was even close thos this mark.
    Fidelity - 4/5
    Although a very good entry, this program is not without bugs:
    Any tags with numeric characters (eg. <h1> <h2>) are all counted as one tag. He used isalpha() to parse the tag name from parameters.
    Uppercase tags and lowercase tags are counted as two different types of tags.
    Instead of outputting total number of tags, the program outputs total number of different tags.
    Portability - 3/3
    Code compiled on mingw without errors or warnings, on CodeWarrior without errors or warnings (or so I hear) and on MSVC++ 6 with 92 warnings. (The warnings were due to a compiler bug)
    Total: 12/13

    *ClownPimp*
    Speed - 4/5
    Entry was submitted about an hour after the contest started
    Fidelity - 4.5/5
    Doesn't output total number of tags
    Similar to Sang-Drax's submission, the program differentiates between upper and lower case tags.
    Portability - 3/3
    Compiled on mingw with no errors and no warnings, compiled on MSVC++ 6 with 103 warnings (Again, bugs)
    Total: 11.5/13

    Sh0rt
    Speed - 3/5
    Entry was submitted sometime that night... I can't remember when. Lets just say very late.
    Fidelity - 2.5/5
    The program doesn't print Document Title, Filename or Filesize. Output is cluttered with predefined tags (mostly marked with a count of 0). Two things this program did which others didn't is correctly print total number of tags, and count uppercase/lowercase tags as the same tag.
    Doesn't output tags which are not predefined in the source code.
    Portability - 1/3
    Windows specific functions are used (SetConsoleTitle), as well as non-standard functions like getch() and depricated headers are included in the source (vector.h)
    I had to modify the source quite a bit (considering its size) to get it to compile on mingw.
    Total: 6.5/13

    Travis-Dane
    Speed - 3.5/5
    Entry was submitted an hour and a half after the contest commenced.
    Fidelity - 1/5
    Has very few predefined tags in the source code. Works on a system of predefined tags. Doesn't print to stdout.
    Doesn't print filename
    Doesn't print document title
    Doesn't print total number of tags
    Doesn't print filesize
    Portability - 2/3
    Uses conio.h and getch(). Other than that, compiles fine on mingw and MSVC++ 6
    Total: 5.5/13
    Congratulations Sang-Drax, you win. Entries are attached.
    Attached Files Attached Files

  4. #49
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Hehe, it was a fun contest, I guess I should've used isalnum() instead.

    I have a question regarding HTML:

    is "< br>" considered a valid tag (ie with a space right after the <) ?

    My submission doesn't count these tags as valid, but I rememberd and fixed that along with the case problem after I had submitted. That was after some time had passed though, so there were no reason to resubmit.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #50
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    If anyone is interested, here's a better version with some bugs fixed.

    It doesn't ignore tags within <!-- --> though.
    Attached Files Attached Files
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #51
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by Sang-drax
    Hehe, it was a fun contest, I guess I should've used isalnum() instead.

    I have a question regarding HTML:

    is "< br>" considered a valid tag (ie with a space right after the <) ?

    My submission doesn't count these tags as valid, but I rememberd and fixed that along with the case problem after I had submitted. That was after some time had passed though, so there were no reason to resubmit.
    Hmm, If I wasn't so damn lazy I'd send it a page through the W3C HTML validator to test that.
    Oh well, it's not like I used any test pages which had anything resembling an invalid tag.

  7. #52
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    Originally posted by Sang-drax
    Hehe, it was a fun contest, I guess I should've used isalnum() instead.

    I have a question regarding HTML:

    is "< br>" considered a valid tag (ie with a space right after the <) ?

    My submission doesn't count these tags as valid, but I rememberd and fixed that along with the case problem after I had submitted. That was after some time had passed though, so there were no reason to resubmit.
    < br> is a valid tag, under w3 and others.
    Same with other tags, < body>, < html> and so on.

  8. #53
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    why wasnt my entry listed!

  9. #54
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Originally posted by RoD
    why wasnt my entry listed!
    LOL...

    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  10. #55
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    It was the best one and he knowssssssssssssss it

  11. #56
    Registered User Josh Kasten's Avatar
    Join Date
    Jul 2002
    Posts
    109
    when is the next contest going to be?
    int a; don't make a program without it.

  12. #57
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by Josh Kasten
    when is the next contest going to be?
    Probably this weekend.

  13. #58
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Tommorow, same bat time, same bat channel. That's Saturday February 8th, #cprogramming.com on DALnet. 10PM GMT.

  14. #59
    Registered User
    Join Date
    Jul 2002
    Posts
    32
    There's a text compression contest on the cprogramming.com main site. Is that still running?

Page 4 of 4 FirstFirst 1234
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I am very new . . . :(
    By Eternalglory47 in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2008, 12:29 PM
  2. Comp sci contests
    By Sfel in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-20-2007, 04:13 PM
  3. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  4. Replies: 6
    Last Post: 01-08-2006, 02:49 PM
  5. Future of cprogramming.com contests
    By Eibro in forum Contests Board
    Replies: 16
    Last Post: 05-12-2003, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21