Skip to main content
added tio link
Source Link
hdrz
  • 1k
  • 6
  • 6

Object PascalPascal (FPC), 204 200 bytes

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.
var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Try it online!

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.
var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.
var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Object Pascal, 204 200 bytes

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.
var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Pascal (FPC), 204 200 bytes

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Try it online!

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.
var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.
var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.
deleted 100 characters in body
Source Link
hdrz
  • 1k
  • 6
  • 6

Object Pascal, 204 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: integer;
  g: string = 'nykd-'; // unique 4th char of names, '-' in 'pac-man', could also use the 3rd charbyte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], g'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Object Pascal, 204 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: integer;
  g: string = 'nykd-'; // unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], g)]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Object Pascal, 204 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.
other form of binary operators
Source Link
hdrz
  • 1k
  • 6
  • 6

Object Pascal, 204204 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1shl Pos=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1shl i1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 shl<< pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 shl<< i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: integer;
  g: string = 'nykd-'; // unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], g)]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Object Pascal, 204 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1shl Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1shl i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 shl pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 shl i and s=0)or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: integer;
  g: string = 'nykd-'; // unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], g)]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.

Object Pascal, 204 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline. Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, 227 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: integer;
  g: string = 'nykd-'; // unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], g)]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.
added another version
Source Link
hdrz
  • 1k
  • 6
  • 6
Loading
Source Link
hdrz
  • 1k
  • 6
  • 6
Loading