Re: copying arrays



Alan Manuel K. Gloria wrote:
In my experience it's quite rare to have to have to *copy* a
sequence. If you're manipulating an array, why would you want to
retain the previous version?

In a game, you might want to pass the state of the game
(e.g. the board in a board game) to a computer player
so it can decide what it wants to do. The safe way to do that
would be to pass the player a copy, so the player doesn't
corrupt the game. Often the player will destructively modify
the board, but undo all its changes at the end. With a copy,
you can also check the player for correctness by comparing
the final state of the player's copy with the original board.

--
Dan
www.prairienet.org/~dsb/
.



Relevant Pages

  • Board games for practising Keigo
    ... I dreamed of a board game for practising Keigo and would like to ... In my mind I have a rough concept a board similar to Monopoly for 4 ... When a player got an instruction to say something to another player, ...
    (sci.lang.japan)
  • ANN: Pentago AI Player Testbench 0.3.5
    ... Pentago is an easy to learn, fun, abstract strategy board game. ... just before Christmas 2005 and soon decided to write my own AI player. ...
    (comp.lang.python.announce)
  • driving me nuts
    ... I am looking for the name of a board game that i had approx 8 - 10 yrs ... It consisted of each player taking it in turns to wear 'goggles' ... Please please stop me from going insane! ...
    (uk.games.board)
  • Re: Which is faster - hash or array lookup
    ... I am suite sure that perl is not The Right Tool ... Each player has 5 pieces, and additionally there is a common ... whereas traversing an array looking for $n is slow). ...
    (comp.lang.perl.misc)
  • Array/Pointer is causing a STATUS_ACCESS_VIOLATION is g++
    ... I have two classes, Player and CardDeck. ... array called drawCards. ... from the player array a card (an int value) out of the drawCards array. ...
    (comp.lang.cpp)