Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
Last active December 5, 2021 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrueBrain/fe878869c896aa070ff477c45cc3463e to your computer and use it in GitHub Desktop.
Save TrueBrain/fe878869c896aa070ff477c45cc3463e to your computer and use it in GitHub Desktop.
I wrote:
/* Set the production / acceptance of the industry. */
GitHub CoPilot wrote:
let mut production_output = Vec::new();
for cargo_label in &industry.production {
production_output.extend(ctt[cargo_label].to_le_bytes());
}
let mut acceptance_output = Vec::new();
for cargo_label in &industry.acceptance {
acceptance_output.extend(ctt[cargo_label].to_le_bytes());
}
Which is nearly exactly what I would have done, with the difference of the variable name.
Next I wrote:
write_pseudo_sprite(output, &[b"\x00\x0a\x01\x01", &[industry.id], b"\x25", &[industry.production.len() as u8], &production_output]);
After which GitHub CoPilot wrote:
write_pseudo_sprite(output, &[b"\x00\x0a\x01\x01", &[industry.id], b"\x26", &[industry.acceptance.len() as u8], &acceptance_output]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment