Post general comments here

by Alex on Apr 28, 2015 - 11:48:46 pm UTC
  • (3/0)
This is the place to post general comments, such as pressing bugs or broader questions.

Comments (Search)

What is the policy on submitting problems here? :)
I mean writing or adding problems?

Everybody is free to create problems. Send a problem statement, a thoroughly tested solution, and test data to one of the admins (Hanson, Jacob, Toby, or me). If you are unable to solve the problem yourself, you can send just the problem statement to Hanson. If the problem is suitable, one of us will add it.

Thanks, will do so when I get a chance. :)
What kind of problems are you looking for? Standard problems from contests or original? The latter is quite difficult to find.

We can add contest problems ourselves. We're looking for original problems, like the Bi-Weekly Challenge ones.

Which contest problems do you usually add? I see CCC and COCI ones. Are you interested in any other contest problems? (IOI, IPSC, Chinese OI, etc?)

If you have any requests, we can add them for you :)

Wow, thanks! :)

I was just thinking about the IOI problems and maybe ACM problems later for practice since most other Judges don't tell you anything about your submission other than it fails...which is not helpful at all. Though I don't want to clog up your Judge (does the number of problems in the database matter?)

feel special now?? :P

was just testing something....

What is reputation?

It's 10*(# of comment upvotes you've received) - 2*(# of downvotes you've received) - (# of downvotes you've given).
Doesn't affect anything, though :P (though it might in the future..)

Hehe, okay. Will keep that in mind. :) Pretty nice Judge, how long have you guys been working on it?

One of the problems I've always had with graphics is inputting
I can't seem to find a function that will allow me to input variable wherever I want on the graphic screen. I've tried function like moveto and gotoxy, but these only work for outputting.

I've seen people input in places other than the top left corner before so I know its possible

So does anyone know what this function or method of doing it is?


BGI input is done with readkey. You CANNOT input variables.

I'll include a code snippet for you. (Okay, it's a long snippet. It inputs a number as a string, converts, then outputs it. There's also some error handling.)

Note that if you are using Free Pascal, you should also include WinCrt.

This was written completely for compatibility with Turbo (I have only tested on FP, though.)

Uses Graph, Crt;
{ ... }
s: String;
gd, gm, error: SmallInt; { Integer for non-Free Pascal }
n: LongInt;
ch: Char;
{ ... }
{ ... }
InitGraph( gd, gm, '' );
If GraphResult <> grOK then
WriteLn( 'Sorry, graphics not supported' );
Delay( 1000 ); // let them see the message
Halt( 1 );
SetColor( LightGray );
OutTextXY( 100, 100, 'Enter a number: ' ); { prompt }
s := ''; { init s }
ch := ReadKey;
SetColor( GetBkColor ); { set to background colour and erase string }
OutTextXY( 100 + TextWidth( 'Enter a number: ' ), 100, s ); { the + TextWidth allows you to format it perfectly }
if ch = #13 then { if they press enter; #13 is CR }
Val( s, n, error ); { try to get a value }
if error <> 0 then { if there's an error }
SetColor( Red ); { nice error colour :) }
OutTextXY( 100, 200, 'INVALID INPUT' ); { feedback }
Delay( 500 ); { wait for 1/2 a second so user can see }
SetColor( GetBkColor ); { set it to the background colour so you can }
OutTextXY( 100, 200, 'INVALID INPUT' ); { erase the message }
Continue; { don't add to the string }
Break; { you've got a number! }
else if ch = #8 then // if they press backspace
s := Copy( s, 1, Length( s ) - 1 );
s := s + ch;
SetColor( LightGray );
OutTextXY( 100 + TextWidth( 'Enter a number: ' ), 100, s );
Until false; // only allow it to break itself
SetColor( LightGreen );
OutTextXY( 100, 100, 'You entered ' + s + '.' );
If 2 * n > 9000 then
s := 'OVER 9000!!!'
Str( 2 * n, s );
s := s + '.';
OutTextXY( 100, 100, 'Twice that is ' + s ); { so you know you converted }
{ ... }

ok, i'll guess i'll just read key bunch of times, but do you know how to
readkey, wherever you want on the page.. ike what function will allow you to change the spot where you input the key?

I'm not sure I understand your question, but readkey has no feedback. You have to OutTextXY() where you want to give your feedback.

I think you're talking about GotoXY for console applications?

when you readkey, the user types something on the screen, right?
So what I mean is, Is there a way of changing where you input the key on the screen, like if you want to input in a convenient spot rather than the top-left corner.

BTW: Go on chat at 9:35, if you are still on by then

The user types, but this is not echoed. When you use readln, it reads each character and echoes it back, so the user can see it. With readkey, echoing is a little different. You store the readkey result in a char, add this to a string, and output the string wherever you want.

readln ECHOES

var s: string;
var c: char;

s := '';

{ This inputs using readkey and echoes in graphics mode }
c := readkey;
setcolor( getbkcolor ); // set to the backgroun color; works as an eraser
outtextxy( 0, 0, s ); // erase the string
if c <> #13 then
s := s + c; //
setcolor( white ); // so they can see
outtextxy( 0, 0, s ); // and output it
until c = #13;

Just to clarify readkey, when then user types something, it doesn't actually appear on the screen (unlike readln). This can be very good sometimes, like for games in general, but if you really want it to appear then you have to do what jargon suggests.

suppose I have a 2-d aeray of type string and I want to call upon the 2nd letter of a string that is at column and row 5, would this be the syntax line

Declaration: board:array[1..8][1..8] of string;

actual call: c:=board[3][5][2]

I'm not sure if the character position is supposed to be at the first square bracket or in the last one?

Think of a string as an array. Your declaration
  board:array[1..8][1..8] of string;
is actually
  board: array[ 1..8, 1..8 ] of packed array[ 1..128 ] of char;
So of course you'd reference the character last.

Therefore, to access character 3 of the string at position (4, 7), you'd do this:
(* c is a char *)  
c := board[ 4, 7, 3 ]; // or c := board[4][7][3];

Will peg survive?
Could it be run without teachers? (Possibility even?)
Are any other teachers willing to take up this task?

Give suggestions, people!!!

No, it can't be run without teachers, as teacher supervision is required at all times. However, Mr. Fenty says he would be willing to supervise PEG. A big issue is funding - now that the PEG store has been extinguished, it is unclear how we can raise the funds to go to ACSL. There could always be PEG without ACSL, but then it wouldn't really be PEG anymore.

There is a reasonably good chance we can get support from past PEG members.
However, personally I would only really want to have PEG with people who are definitely gonna go to ACSL and maybe a few extra - it will be dead the year after me, Brian, and Toby graduate (year after next) almost for certain, so I don't feel like going through the trouble of teaching people who don't really care and who won't even be going.

So will PEG Store be able to operate after school next year?

I was actually hoping we could invent some other fundraiser.

Might it be possible for us to develop micro-scale applications for staff and students?

Yes, I see no reason why the PEG Store wouldn't be allowed to be open after school (though this doesn't raise enough revenue by itself).
Brian, what sort of applications do you have in mind? This seems like a not-too-stable source or fundraising, probably very few people would buy anything.

Perhaps one of those rent-a-coder websites?

Why not just make everyone pay the full price (or slightly reduced) for the ACSL? I know my parents are willing to pay that.
(Jeeze, the Churchill trip's over $1000)

Also, who'd accompany us to ACSL? Would Mr.Wright come out of retirement to drive us?

Paying the full price wouldn't be a viable option for some people. (It is for me; I'm just saying...)

The Churchill trip isn't over $1000. No idea where you got that number...

When it is not a viable option, then we have PEG subsidize it.
As for the Churchill Trip, I believe it was $1200 last year.

it was 700 last year and it's 700 this year too...

It would be more like $1400 for ACSL if you paid full price.
I think the school pays for half because we have connections in the SAC. Also, it does make sense, since we always win every year.

Any chance of having a last meeting (hopefully of this year) to discuss the future of PEG? It's not too effective here in the comments.

I don't think that would be a good idea, because input from many people on this topic won't do us any good - I don't think we have much choice about what will happen next year and after that.

I'm trying to import pictures from the internet to my game
and I was wondering how to do it.
I'm doing chess and rather than have letters, like 'K' for King, 2-d pieces would be much better.
Does anyone have a short explanation or a site I can view to see how to use pictures in pascal?

I don't think there's a very simple way to do it - I've done a lot of Pascal graphics, and never imported a picture. But I see little reason why you'd want to. Just make a procedure to draw it yourself! For chess, it'll probably just be a few lines. Making a procedure that can draw a piece of a certain colour would make your code shorter:

procedure DrawPawn(x,y:integer; col:word) 

I know of two libraries for graphics: libpng and pasjpeg. They're written for Free Pascal, so I don't know if they'd be any use with Turbo or Dev.

Of course, Jacob's suggestion is best. Code your own; it shows more effort and it's easy to do.

How about an upload service to the judge?

Jacob's internet connection would be crippled by the traffic of image downloads.
If you send them to one of us (me, Toby, Brian, Jacob), we can post them on the main PEG server (which is hosted by some company)

If you plan to give us photos for private (PEG only) download, be sure that it is WinRARed and all blurry or super dark photos are deleted. It would also be very helpful if the important group photos and especially funny photos are named accordingly, with underscores instead of spaces.

How about funny (large) videos? Should I shrink them to something not 720p?

The group photo of the year.

Needs to be retouched to remove redeye. Also, there's a glint from Harun's tooth. He looks positively maniacal right now.

Toby looks high.

I think Pritchard is doing it on purpose..

Photo here.

The following
   BOI09 - Diamonds 
BOI09 - Special Sequence
BOI09 - Frogs
BOI09 - Boxen
BOI09 - Minesweeper
APIO07 #3 - Zoo
are missing their problem descriptions...

Yup, we're working on it. These problems are still new.

btw what's BOI?

Bulgarian national Olympiad in Informatics (I believe it's the Bulgarian version of the CCC).

BOI is posted!