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.
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.
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.
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?)
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?)
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..)
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..)
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?
Thanks
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 [size=14][b]readkey[/b][/size]. You [i]CANNOT[/i] 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.)
[code]
Uses Graph, Crt;
{ ... }
Var
s: String;
gd, gm, error: SmallInt; { Integer for non-Free Pascal }
n: LongInt;
ch: Char;
{ ... }
Begin
{ ... }
InitGraph( gd, gm, '' );
If GraphResult <> grOK then
begin
WriteLn( 'Sorry, graphics not supported' );
Delay( 1000 ); // let them see the message
Halt( 1 );
end;
SetColor( LightGray );
OutTextXY( 100, 100, 'Enter a number: ' ); { prompt }
s := ''; { init s }
Repeat
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 }
begin
Val( s, n, error ); { try to get a value }
if error <> 0 then { if there's an error }
begin
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 }
end
else
Break; { you've got a number! }
end
else if ch = #8 then // if they press backspace
begin
s := Copy( s, 1, Length( s ) - 1 );
Continue;
end;
s := s + ch;
SetColor( LightGray );
OutTextXY( 100 + TextWidth( 'Enter a number: ' ), 100, s );
Until false; // only allow it to break itself
ClearDevice;
SetColor( LightGreen );
OutTextXY( 100, 100, 'You entered ' + s + '.' );
If 2 * n > 9000 then
s := 'OVER 9000!!!'
Else
Begin
Str( 2 * n, s );
s := s + '.';
End;
OutTextXY( 100, 100, 'Twice that is ' + s ); { so you know you converted }
CloseGraph;
{ ... }
End.
[/code]
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; { ... } Var s: String; gd, gm, error: SmallInt; { Integer for non-Free Pascal } n: LongInt; ch: Char; { ... } Begin { ... } InitGraph( gd, gm, '' ); If GraphResult <> grOK then begin WriteLn( 'Sorry, graphics not supported' ); Delay( 1000 ); // let them see the message Halt( 1 ); end; SetColor( LightGray ); OutTextXY( 100, 100, 'Enter a number: ' ); { prompt } s := ''; { init s } Repeat 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 } begin Val( s, n, error ); { try to get a value } if error <> 0 then { if there's an error } begin 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 } end else Break; { you've got a number! } end else if ch = #8 then // if they press backspace begin s := Copy( s, 1, Length( s ) - 1 ); Continue; end; s := s + ch; SetColor( LightGray ); OutTextXY( 100 + TextWidth( 'Enter a number: ' ), 100, s ); Until false; // only allow it to break itself ClearDevice; SetColor( LightGreen ); OutTextXY( 100, 100, 'You entered ' + s + '.' ); If 2 * n > 9000 then s := 'OVER 9000!!!' Else Begin Str( 2 * n, s ); s := s + '.'; End; OutTextXY( 100, 100, 'Twice that is ' + s ); { so you know you converted } CloseGraph; { ... } End.
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?
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?
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
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.
[b]readln ECHOES
readkey DOES NOT ECHO[/b]
[code]
var s: string;
var c: char;
s := '';
{ This inputs using readkey and echoes in graphics mode }
repeat
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;
[/code]
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 readkey DOES NOT ECHO
var s: string; var c: char;
s := '';
{ This inputs using readkey and echoes in graphics mode } repeat 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.
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;
c:char;
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?
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; c:char;
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
[code] board:array[1..8][1..8] of string;[/code]is actually
[code] board: array[ 1..8, 1..8 ] of packed array[ 1..128 ] of char;[/code]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:
[code](* c is a char *)
c := board[ 4, 7, 3 ]; // or c := board[4][7][3];[/code]
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!!!
Will peg survive? Could it be run without teachers? (Possibility even?) Are any other teachers willing to take up this task?
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.
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.
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.
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.
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.
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?
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...
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...
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.
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.
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 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'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:
[code]procedure DrawPawn(x,y:integer; col:word)
begin
setcolor(col);
setfillstyle(1,col);
line(x,y,x+10,y+10);
{etc...}
end;[/code]
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) begin setcolor(col); setfillstyle(1,col); line(x,y,x+10,y+10); {etc...} end;
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.
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.
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)
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.
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.
Comments (Search)
I mean writing or adding problems?
What kind of problems are you looking for? Standard problems from contests or original? The latter is quite difficult to find.
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?)
was just testing something....
Doesn't affect anything, though :P (though it might in the future..)
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?
Thanks
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.)
readkey, wherever you want on the page.. ike what function will allow you to change the spot where you input the key?
I think you're talking about GotoXY for console applications?
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
readln ECHOES
readkey DOES NOT ECHO
Declaration: board:array[1..8][1..8] of string;
c:char;
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?
is actually
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:
Could it be run without teachers? (Possibility even?)
Are any other teachers willing to take up this task?
Give suggestions, people!!!
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.
Might it be possible for us to develop micro-scale applications for staff and students?
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.
(Jeeze, the Churchill trip's over $1000)
Also, who'd accompany us to ACSL? Would Mr.Wright come out of retirement to drive us?
The Churchill trip isn't over $1000. No idea where you got that number...
As for the Churchill Trip, I believe it was $1200 last year.
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.
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?
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?
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)
Photo here.
are missing their problem descriptions...